Image Processing Toolbox    
gray2ind

Convert an intensity image to an indexed image

Syntax

Description

gray2ind scales, then rounds, an intensity image to produce an equivalent indexed image.

[X,map] = gray2ind(I,n) converts the intensity image I to an indexed image X with colormap gray(n). If n is omitted, it defaults to 64.

Class Support

The input image I can be of class uint8, uint16, or double. The class of the output image X is uint8 if the colormap length is less than or equal to 256. If the colormap length is greater than 256, X is of class double.

See Also

ind2gray


 getimage grayslice