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
double
are assumed to have values between 0 and 1 anduint8
images are assumed to have values between 0 and 255. Since yourdouble
data contains values between 0 and 255 (since you simply cast it as adouble
and 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
imshow
to 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
double
version usingmat2gray
prior to displaying the image