Some of the Image Processing Toolbox functions have to assume a particular dynamic range. By convention, this range is [0,1] for data of type 'double', but [0,255] for data of type 'uint8'. Therefore, the IM2DOUBLE function should be used as it handles this scaling automatically. For example, your code thus becomes:
I = rgb2gray(ColorImage);
ent1 = entropy(I);
I = im2double(I);
ent2 = entropy(I);
Both 'ent1' and 'ent2' should be equal.
Best Answer