2012-09-21 39 views
4

我想計算matlab中圖像的峯度。 Matlab有一個函數kurtosis 我可以在矩陣上使用這個函數。例如:圖像上的峯度函數

m = rand([4 5]); 
kurtosis(m(:)); 

雖然當我使用這個灰度圖像:enter image description here

I = imread('0.tiff'); 
kurtosis(I(:)); 

我得到這個錯誤:現在

Error using - Integers can only be combined with integers of the same class, or scalar doubles.

Error in kurtosis (line 39) x0 = x - repmat(nanmean(x,dim), tile);

我的問題是:我在做什麼錯了,我怎樣才能計算圖像的峯度。

+0

嘗試輸出我看看你是否有二維數組。而對於Tiff文件,你需要第二個參數(我認爲)。即我= imread('0.tiff',1)等 – specialscope

+0

變量我是因爲它應該是我認爲(我可以做imshow(我)並看到圖像)。如果我輸出的圖像,我看到0到25​​5之間的值,就像一個灰度圖像應該是。 (順便說一句(I(:),2),也不起作用) – Ojtwist

+1

+1爲史詩般的照片! :-) –

回答

5

峯度需要我是雙倍的。這工作:

kurtosis(double(I(:))); 

或本

kurtosis(double(I));