FUNCTION REFERENCE
ind2rgb
Convert an indexed image to RGB.
Convert an indexed image to RGB.
Syntax
RGB = ind2rgb(X, map)Looks up each index of the 2-D image X in the c-by-3 colormap and returns an M-by-N-by-3 double image. For uint8 and uint16 X the value 0 is the first colour and values are clipped to [0, c-1]; for double and single X the value 1 is the first colour and values are clipped to [1, c].
Example
ind2rgb(uint8([0 2]), [0 0 0; 0.5 0.5 0.5; 1 0 0]) % 1x2x3, second pixel redExample
ind2rgb([1 9], gray(2)) % 9 is clipped to 2 (white)Differences from MATLAB: non-integer or NaN indices are an error.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.