DADiSP Worksheet Functions > Function Categories > Image Processing > RGB2MONO

 

RGB2MONO

Purpose:

Converts an RGB image to an 8 bit monochrome image.

Syntax:

RGB2MONO(image)

image

-

An array, the RGB image.

Returns:

An array, an 8 bit monochrome image.

Example:

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.

Remarks:

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.

See Also:

DENSITY

GETCOLORMAP

GETRGB

IMAGE24

IMINTERP

INTERP2

READIMAGE

RGBIMAGE

SPLINE2