Re: R,G,B image [message #10514 is a reply to message #10513] |
Tue, 09 December 1997 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Luis M. Gonzalez (lmgc@gmv.es) writes:
> I have a bi-dimensional image as a three R,G,B vectors.
> Is it possible to display it directly within IDL? Or should we
> convert each RGB triple into an index to the color table?.
Here is what I would do. Suppose your vectors (r, g, b) describe
a 400 by 300 image.
; Create a 24-bit pixel interleaved image.
image24 = BytArr(3, 400, 300)
image24[0,*,*] = Reform(r, 400, 300)
image24[1,*,*] = Reform(g, 400, 300)
image24[2,*,*] = Reform(b, 400, 300)
; Display the 24-bit image directly in IDL.
TV, image24, True=1
The last command would tie your image to the color table
indices. That is, the image values would be run through
the color tables when they are displayed to select the
display color. You may prefer to see the "true" color.
If you are on an 8-bit system (I presume you are from your
color table question), then you may want to do this:
trueColorImage = Color_Quan(image24, 1, red, green, blue)
TVLCT, red, green, blue
TV, trueColorImage
Cheers,
David
-----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|