RGBIMAGE

Purpose:

Creates a 24 bit image from red, green and blue components.

Syntax:

RGBIMAGE(r, g, b)

r

-

An array, the red values.

g

-

An array, the green values.

b

-

An array, the blue values.

Returns:

An array, a 24 bit color image.

 

RGBIMAGE(a, val) sets or resets the interpretation of the data values as composite RGB values.

 

val = RGBIMAGE(a) returns 1 if the image is a 24 bit RGB image, else 0.

Example:

W1: density(spline2(ravel(gnorm(100,1),10), 8));rainbow()

(r, g, b) = getrgb(W1)

W2: rgbimage(r, g*1.1, b);

 

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 with the green intensities increased by 10%.

Example:

W1: readimage(".\data\mandrill.bmp")

W2: W1;gray

W3: W2;rgbimage(1)

 

W1 contains a 24 bit RGB color image.  W2 copies the image and re-shades it with a black to white colormap. Although the data values are not changed, the color shading is altered and the data is no longer marked as a 24 bit image. However, because the data values are unchanged, rgbimage(1) restores the original 24 bit color scheme for the image.

Remarks:

Unlike standard images, a 24 bit image does not reference a separate colormap. Instead, each pixel of the image is comprised of a composite 24 bit RED, GREEN, BLUE value packed into a long integer (4 bytes). Use

 

(r, g, b) = getrgb(image)

 

to retrieve the separate red, green and blue values from a composite 24 bit image.

 

image = rgbimage(r, g, b)

 

to construct a 24 bit composite image from separate RGB values.

 

Because 24 bit color images do not require a colormap (the colors are implicit), the image can be saved and restored automatically with the correct colors.

 

isrgb = rgbimage(image)

 

returns 1 if the image is 24 bit, else 0.

 

See GETRGB to return the red, green and blue components of an image as separate arrays.

 

See RGBTOCOLOR to convert RGB values into a color index.

See Also:

DENSITY

GETCOLORMAP

GETRGB

IMAGE24

IMCONV

IMINTERP

INTERP2

READIMAGE

RGBTOCOLOR

SPLINE2