Function Reference
— Function File: RGB = label2rgb(L)
— Function File: RGB = label2rgb(L, map)
— Function File: RGB = label2rgb(L, map, background)
— Function File: RGB = label2rgb(L, map, background, order)

Converts a labeled image to an RGB image.

label2rgb(L) returns a color image, where the background color (the background is the zero-labeled pixels) is white, and all other colors come from the jet colormap.

label2rgb(L, map) uses colors from the given colormap. map can be

  • A string containing the name of a function to be called to produce a colormap. The default value is "jet".
  • A handle to a function to be called to produce a colormap.
  • A N-by-3 colormap matrix.

label2rgb(L, map, background) sets the background color. background can be a 3-vector corresponding to the wanted RGB color, or one of the following strings

"b"
The background color will be blue.
"c"
The background color will be cyan.
"g"
The background color will be green.
"k"
The background color will be black.
"m"
The background color will be magenta.
"r"
The background color will be red.
"w"
The background color will be white. This is the default behavior.
"y"
The background color will be yellow.

label2rgb(L, map, background, order) allows for random permutations of the colormap. order must be one of the following strings

"noshuffle"
The colormap is not permuted in any ways. This is the default.
"shuffle"
The used colormap is permuted randomly.
See also: bwlabel ind2rgb