REDUCE_COLORS

The REDUCE_COLORS procedure reduces the number of colors used in an image by eliminating pixel values without members.

The pixel distribution histogram is obtained and the WHERE function is used to find bins with non-zero values. Next, a lookup table is made where table[old_pixel_value] contains new_pixel_value, and is then applied to the image.

This routine is written in the IDL language. Its source code can be found in the file reduce_colors.pro in the lib subdirectory of the IDL distribution.

Examples

To reduce the number of colors and display an image with the original color tables R, G, B enter the commands:

REDUCE_COLORS, image, v

TVLCT, R[V], G[V], B[V]

Syntax

REDUCE_COLORS, Image, Values

Arguments

Image

On input, a variable that contains the original image array. On output, this variable contains the color-reduced image array, writing over the original.

Values

A named variable that, on output, contains a vector of non-zero pixel values. If Image contains pixel values from 0 to M, Values will be an M+1 element vector containing the mapping from the old values to the new. Values[i] contains the new color index of old pixel index i.

Keywords

None.

Version History

Pre-4.0

Introduced

See Also

COLOR_QUAN