FUNCTION REFERENCE

label2rgb

Convert nonnegative region labels to RGB colors.

Convert nonnegative region labels to RGB colors.

Syntax

RGB = label2rgb(L, cmap, zerocolor, 'shuffle')

Returns an M-by-N-by-3 uint8 image. Default colormap is jet and background color is white. A numeric colormap must have at least max(L(:)) rows. Colormaps may also be named. zerocolor accepts a color name, RGB triplet or hex code. shuffle permutes colors using the engine RNG stream; default is noshuffle.

Example

label2rgb([0 1;2 0], [1 0 0;0 1 0], 'white')

Differences from MATLAB: Function-handle colormaps and categorical labels are not supported. Labels are bounded at 1000000; named engine colormaps have their existing 4096-row limit. Named palettes use the engine color ramps.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.