Re: Color image [message #4660] |
Wed, 12 July 1995 00:00 |
pa64
Messages: 3 Registered: January 1995
|
Junior Member |
|
|
In article <3tp657$e32@apakabar.cc.columbia.edu>, jun@parsifal.phys.columbia.edu (Jun Xu) writes:
|> Hi, more questions.
|>
|> We have several images of sky, each in different band
|> of wavelength. Now we want to construct a color image
|> from these images. Does anyone have good ideas of how to
|> do this in IDL?
|>
|> Thanks.
|>
|> Jim
|>
try the following - with three images ( red green blue):
pro tvci,red,green,blue,shiftr=shiftr,shiftg=shiftg,shiftb=shift b,si=si
if not keyword_set(shiftr) then shiftr = [0,0]
if not keyword_set(shiftg) then shiftg = [0,0]
if not keyword_set(shiftb) then shiftb = [0,0]
if not keyword_set(si) then si=[512,512]
shiftmx = shiftr > shiftg > shiftb
shiftmn = shiftr < shiftg < shiftb
; show colorimage from separate channels:
sr=size(red)
if sr(0) eq 2 then si = sr(1:2) > si
sg=size(green)
if sg(0) eq 2 then si = sg(1:2) > si
sb=size(blue)
if sb(0) eq 2 then si = sb(1:2) > si
si=si + shiftmx - shiftmn
sx=si(0)
sy=si(1)
ci = bytarr(sx,sy,3)
if sr(0) eq 2 then begin
shx = (shiftr-shiftmn)(0)
shy = (shiftr-shiftmn)(1)
if sr(3) eq 1 then ci(shx,shy,0) = red $
else ci(shx,shy,0) = bytscl(red)
endif else ci(*,*,0) = byte(red)
if sg(0) eq 2 then begin
shx = (shiftg-shiftmn)(0)
shy = (shiftg-shiftmn)(1)
if sg(3) eq 1 then ci(shx,shy,1) = green $
else ci(shx,shy,1) = bytscl(green)
endif else ci(*,*,1) = byte(green)
if sb(0) eq 2 then begin
shx = (shiftb-shiftmn)(0)
shy = (shiftb-shiftmn)(1)
if sb(3) eq 1 then ci(shx,shy,2) = blue $
else ci(shx,shy,2) = bytscl(blue)
endif else ci(*,*,2) = byte(blue)
tv,color_quan(ci,3,r,g,b) & tvlct,r,g,b
end
Regards,
Hermann Mannstein
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~
Hermann Mannstein Tel.: +49 8153 28-2503
Institut fuer Physik der Atmosphaere or -1118
DLR - Oberpfaffenhofen Fax.: +49 8153 28-1841
Postfach 1116 email.: H.Mannstein@dlr.de
D-82230 Wessling \
Germany \ O
________\/|________
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`--------\--------'~ ~~~~~~~~~~~~~~~~~~~~
\
|
|
|