| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Image Processing Toolbox |
| Contents | Index |
| Learn more about Image Processing Toolbox |
I = ind2gray(X,map)
I = ind2gray(X,map) converts the image X with colormap map to a grayscale image I. ind2gray removes the hue and saturation information from the input image while retaining the luminance.
X can be of class uint8, uint16, single, or double. map is double. I is of the same class as X.
load trees I = ind2gray(X,map); imshow(X,map) figure,imshow(I)

ind2gray converts the colormap to NTSC coordinates using 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.
gray2ind, imshow, imtool, mat2gray, rgb2gray, rgb2ntsc
![]() | imview | ind2rgb | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |