The following code snippet results a double image.
f = imread('C:\Users\Administrator\Desktop\2.tif');
h = double(f);
figure;
imshow(h);
whereas, this other code snippet results a uint8 image.
f = imread('C:\Users\Administrator\Desktop\2.tif');
figure;
imshow(f);
While displaying these two figures, the displayed results of these two images using imshow are different, but what is the reason behind this difference?
Images of type
doubleare assumed to have values between 0 and 1 anduint8images are assumed to have values between 0 and 255. Since yourdoubledata contains values between 0 and 255 (since you simply cast it as adoubleand don't perform any scaling), it will appear as mostly white since most values are greater than 1.You can use the second input to
imshowto indicate that you would like to ignore this assumption and automatically scale the display to the dynamic range of the dataOr you can normalize the
doubleversion usingmat2grayprior to displaying the image