DADiSP Worksheet Functions > Function Categories > Image Processing > RGB2MONO
Converts an RGB image to an 8 bit monochrome image.
RGB2MONO(image)
image |
- |
An array, the RGB image. |
An array, an 8 bit monochrome image.
W1: density(spline2(ravel(gnorm(100,1),10),8));rainbow
W2: image24(W1)
W3: rgb2mono(W2)
W1 contains an image of a random surface shaded with the colors of the spectrum ranging from red to blue. W2 converts the image into a 24 bit color image.
W3 contains the monochrome image displayed in the current colormap. The monochrome image contains values ranging from 0 to 255.
RGB2MONO converts the 24 bit image into 8 bit integer values ranging from 0 to 255. The resulting image is displayed using the current colormap.
For each RGB pixel, the converted pixel is determined as follows:
mono = 0.56*r + 0.33*g + 0.11*b
where r, g, b are the red, green and blue components of the original RGB image.