In Matlab, when I use
imshow('trees.tif')
it displays an RGB image, but when I use these two functions
I=imread('trees.tif')
imshow(I)
it displays a gray scale image, and it's still the exact same image.
This only happens with TIFF images, because when I use it for a JPEG image like so:
I=imread('flower.jpg')
imshow(I)
it displays an RGB image, and it's the same thing as imshow('flower.jpg')
.
Can anyone please explain why the use of imread
/imshow
on TIFF images displays them in gray scale?
Load the color map too:
[I,cmap] = imread('trees.tif');
Display it with the map:
imshow(I,cmap)
Convert it to RGB:
Irgb = ind2rgb(I,cmap)
So you can display and manipulate it without the colormap:
imshow(Irgb)
imagesc(Irgb)
% etc.
Eye candy:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With