Name

RGB2Ind — converts an RGB image to an indexed image

Calling Sequence

[IndexImage ColorMap] = RGB2Ind(RGB);

Parameters

RGB

3D image of type uint8, uint16, uint32 or double

IndexImage

2D matrix with the same number of rows and columns as RGB

ColorMap

matrix with three columns and as many rows as RGB contains pixels. Note that this parameter is compulsory.

Description

This function converts an RGB image to an indexed image and has the same effect as rgb2ind in previous versions.

Examples

RGB = rand(3, 3, 3) // generate random image

[IndexedImage, ColorMap] = RGB2Ind(RGB) // RGB is converted to an indexed image

FigureHandle = ShowImage(IndexedImage, 'Example', ColorMap); // IndexedImage is displayed

See also

Ind2RGB, ShowImage, ShowColorImage, DrawBoundingBoxes