Displaying TrueColor Images

TrueColor images map data values in a three-dimensional array to Red, Green, and Blue color values, which are combined into a color image for display. The three-dimensional array is made up of three two-dimensional image planes combined into a single array: either (3 x width x height), (width x 3 x height), or (width x height x 3). The organization of the image planes within the file (known as interleaving) is important when displaying images using the TV command, but less so when using the iImage interface.

Displaying TrueColor Images with TV

The TV routine creates a static display of the image data in the specified array. For example, to read the data from the file rose.jpg in IDL's examples/data subdirectory into an IDL variable named rose:

file = FILEPATH('rose.jpg', SUBDIRECTORY=['examples', 'data'])
READ_JPEG, file, rose

You might assume that simply supplying the rose variable to the TV command would result in a color image:

TV, rose

but this does not produce the correct image. The fault here lies with the fact that the TV routine expects, by default, that is argument is a two-dimensional array, when in fact the dimensions of the rose array are [3 x 227 x 149], as shown by the HELP command:

HELP, rose

This arrangement of image planes is known as pixel interleaving. To accurately display the a pixel-interleaved array using TV, set the TRUE keyword equal to 1:

WINDOW, XSIZE=227, YSIZE=149
TV, rose, TRUE=1


rose_image1.gif

The value of the TRUE keyword corresponds to the arrangement of the image planes in the three-dimensional array. Specifically, a width column by height row TrueColor image will use one of the following arrangements:

TRUE Value
Dimensions
Interleaving
1
(3, width, height)
Pixel
2
(width, 3, height)
Line or Row
3
(width, height, 3)
Image

Clearly, you must know the type of interleaving used by your image data before you can display it properly using the TV command.

Displaying TrueColor Images with iImage

The IIMAGE routine removes the requirement that you know in advance how your color image is arranged. To display the rose variable in iImage, simply enter:

IIMAGE, rose


rose_image2.gif

You can immediately notice several things about the iImage display:

In addition, a variety of filtering operations can be applied to the image data by selecting from the Operations menu.

Further Information

For additional information on displaying indexed color images, see: