Image Processing - Matlab TIFF Images in Grayscale

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 grayscale image and it is still the same image.

This only happens with TIFF images, because when I use it for a JPEG image as follows:

 I=imread('flower.jpg') imshow(I) 

it displays an RGB image and it is the same as imshow('flower.jpg') .

Can someone explain why using imread / imshow on TIFF images displays them in grayscale?

+6
source share
1 answer

Download also the color map:

 [I,cmap] = imread('trees.tif'); 

Display it using the map:

 imshow(I,cmap) 

Convert it to RGB:

 Irgb = ind2rgb(I,cmap) 

Thus, you can display and manipulate it without a color map:

 imshow(Irgb) imagesc(Irgb) % etc. 

Eye candy:

enter image description hereenter image description hereenter image description here

+9
source

All Articles