Reputation: 5202
I would like to calculate the Kurtosis of an image in matlab.
Matlab has a function kurtosis
I can use this function on a matrix. For example:
m = rand([4 5]);
kurtosis(m(:));
Though when I use this grayscale image:
I = imread('0.tiff');
kurtosis(I(:));
I get this error:
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);
My question now is: What am I doing wrong, and how can I calculate the kurtosis of an image.
Upvotes: 4
Views: 2920
Reputation: 11810
kurtosis needs I to be double. This works:
kurtosis(double(I(:)));
or this
kurtosis(double(I));
Upvotes: 5