Convert indexed image to grayscale image
I = ind2gray(X,map)
I = ind2gray(X,map) converts
X with colormap
a grayscale image
the hue and saturation information from the input image while retaining
A grayscale image is also called a gray-scale, gray scale, or gray-level image.
X can be of class
map is double.
of the same class as
Load an indexed image into the workspace.
[X, map] = imread('trees.tif');
Convert the image to grayscale using
I = ind2gray(X,map);
Display the indexed image and the converted grayscale image.
imshow(X,map) title('Indexed Image')
figure imshow(I) title('Converted Grayscale Image')
ind2gray converts the colormap to NTSC coordinates
rgb2ntsc, and sets the hue and saturation
components (I and Q) to
zero, creating a gray colormap.
ind2gray then replaces
the indices in the image
X with the corresponding
grayscale intensity values in the gray colormap.