Hi,
I'm a bit confused about 'imshow'
My guessing is that imshow can be used with 2 types of RGB data.
- RGB values are between [0 1] and they have to be double;
- RGB values are between [0 255] and they have to be uint8.
Since that:
I was processing a '.png' file which is an indexed image because when I read in the file using
RGB = imread(fn)
RGB is 400 x 650 uint8 rather than 400 x 650 x 3 uint8. So I know it is an indexed image.
So I read in the file again using code below to convert the indexed image to RGB image
[X,map] = imread(fn)RGB = ind2rgb(X,map) % And here RGB is already 'double'!
The problem is that here actually all the RGB are ranging between [0 1] instead of [0 255] (This can be proved by ploting RGB in the 3D space).
However, when I use
figureimshow(RGB) % knowing that RGB are between [0 1]
I could still show the image
However, when I use
RGB = RGB*255 % to make RGB in the range of [0 255]
RGB = uint8(RGB)figureimshow(RGB)
I can also show the image
I never realized that imshow can deal with 'double' data… just a little confused.
Best Answer