Olivier_s_j
Olivier_s_j

Reputation: 5202

Kurtosis function on image

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: enter image description here

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

Answers (1)

angainor
angainor

Reputation: 11810

kurtosis needs I to be double. This works:

kurtosis(double(I(:)));

or this

kurtosis(double(I));

Upvotes: 5

Related Questions