Re: R,G,B image [message #10513] |
Tue, 09 December 1997 00:00  |
Erard
Messages: 11 Registered: November 1997
|
Junior Member |
|
|
In article <348D4320.18AF@gmv.es>, "Luis M. Gonzalez" <lmgc@gmv.es> wrote:
> Hello,
>
> 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?.
>
There are two solutions, depending on your monitor capabilities:
1- You have a 24 bits monitor (meaning: either you are rich and have a
24-bits X terminal, or you are smart and have a PC/Mac with X emulation or
native IDL). All you have to do is:
TVLCT, indgen(256), ingen(256), indgen(256) ; loads a linear RGB color table
TV, ima24, TRUE=3 ���; Plots the 24 bits image
The value for TRUE is 1, 2, or 3 depending on how the 3 planes are
interleaved in your image (respectively band interleaved by pixel, band
interleaved by line, or band sequential).
If your image comes from a graphic file, it is usually stored with the
color table (see eg, Read_pict).
If you have 3 images, one for each color (for instance if you want to plot
a composite from astronomical images in 3 filters), type:
TV, imageR, Channel= 1 ; Red channel
TV, imageV, Channel= 2 ; G
TV, imageB, Channel= 3 ; B
Channel 0 addresses all 3 planes simultaneously.
2- You only have an 8-bit machine. Just pretend it's 24-bits and compute a
color table adapted to your image with COLOR_QUANT. Only the most frequent
colors are used, so check the quality of the result.
Example : color composite from 3 monochrome images.
x=read_fits('SaturneI.fits',h) ; Read the 3 images, correct position assumed
y=read_fits('SaturneV.fits',h)
z=read_fits('SaturneB.fits',h)
col=!D.N_colors
x=bytscl(x,TOP=col) ;Higher brightness is assumed white
y=bytscl(y,TOP=col) ; (same intensity in each filter)
z=bytscl(z,TOP=col)
trichro=color_quan(z,x,y,r,g,b) ;compute image and table
tv, trichro ; plot the image
tvlct, r, g, b ; load the table
You can use the keyword Cube to reduce the number of colors (from 2 to 6,
cubic root of the number of colors used). The resulting table is lower
quality, but can be used to plot several images simultaneously.
--
St�phane Erard
Institut d'Astrophysique Spatiale
Orsay, France
|
|
|