IMAGE_COLOR_QUANT Function

Quantizes a 24-bit image to 8-bit pseudo-color.

Usage

Input Paramters

Returned Value

Type of Input Description of Output
Image associative array Returns an associative array in image format containing the color quantized (8-bit) pseudo-color image. On error, returns an image associative array with the status key set to 0.
3D byte array Returns a 2D byte array containing the color quantized (8-bit) pseudo-color image. On error, returns 0.

Keywords


NOTE: If the input image is an associative array, the interleaving method is found in the interleave field of the array.

Discussion


NOTE: The original 24-bit image cannot be reconstructed from the 8-bit quantized result.

Example 1


NOTE: The filename used in this example is a UNIX specific filename, which must be modified for use on other platforms.
; Read in a 24-bit image-interleaved image.

chautauqua_8bit = IMAGE_COLOR_QUANT(chautauqua, 256,)

; Convert the image to 8-bit pseudo-color.

IMAGE_DISPLAY, chautauqua_8bit

; Display the 8-bit image.

Example 2

imgx = 477

imgy = 512

red_img = BYTARR(imgx, imgy, /Nozero)

grn_img = BYTARR(imgx, imgy, /Nozero)

blu_img = BYTARR(imgx, imgy, /Nozero)

OPENR, 1, !Data_Dir + 'boulder_red.img'

READU, 1, red_img

CLOSE, 1

OPENR, 1, !Data_Dir + 'boulder_grn.img'

READU, 1, grn_img

CLOSE, 1

OPENR, 1, !Data_Dir + 'boulder_blu.img'

READU, 1, blu_img

CLOSE, 1

; Read the separate red, green, and blue image files.

boulder = BYTARR(imgx, imgy, 3, /Nozero)

boulder(*, *, 0) = red_img

boulder(*, *, 1) = grn_img

boulder(*, *, 2) = blu_img

; Combine the image files into a single 3D array.

; Convert the image to 8-bit pseudo-color.

; Display the 8-bit image.

See Also





doc@boulder.vni.com
Copyright © 1999, Visual Numerics, Inc. All rights reserved.