M-File Help: colorize View code for colorize

colorize

Colorize a greyscale image

out = colorize(im, mask, color) is a color image where each pixel in out is set to the corresponding element of the greyscale image im or a specified color according to whether the corresponding value of mask is true or false respectively. The color is specified as a 3-vector (R,G,B).

out = colorize(im, func, color) as above but a the mask is the return value of the function handle func applied to the image im, and returns a per-pixel logical result, eg. @isnan.

Examples

Display image with values < 100 in blue

out = colorize(im, im<100, [0 0 1])

Display image with NaN values shown in red

out = colorize(im, @isnan, [1 0 0])

Notes

See also

imono, icolor, ipixswitch


 

© 1990-2012 Peter Corke.