| Re: RGB Color reconstruction [message #56474 is a reply to message #56473] |
Tue, 30 October 2007 11:31  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
rpertaub@gmail.com writes:
> I am doing some RGB color reconstruction and I am confused by some of
> the display. I tried to paste my image for greater clarity, but could
> not, so will try to explain as clearly as possible. Here is the simple
> code I am using with three image frames for the 3 RGB channels:
>
> maxes=lonarr(3)
> maxes[0]=max(final_red)
> maxes[1]=max(final_grn)
> maxes[2]=max(final_blu)
>
> final_image=lonarr(3,1272,1052)
> final_Image[0,*,*] = bytscl(final_blu,max=maxes[2])
> final_Image[1,*,*] = bytscl(final_red,max=maxes[0])
> final_Image[2,*,*] = bytscl(final_grn,max=maxes[1])
>
> window,3,title='Reconstructed Cube RGB Image',xsize=1200,ysize=900
> tvscl,final_image,true=1
>
> I get my RGB image thus. Then, I look at one region that is clearly
> blue in color and click on it to get the int of each channel. My print
> out int is thus:
>
> 450nm (blue-ish):3871
> 550nm(green-ish):12518
> 650nm(red-ish):14212
>
> Clearly from the intensities, red channel has the highest intensity.
> Blue is in fact the lowest. Yet, the image at that pixel was BLUE! I
> am obviously not understanding how tvscl,final_image,true=1 works...
>
> Any idea?
Well, quite a lot going wrong here, I think. :-)
First of all, you created a BGR image, instead of an RGB image.
Now I think about it, maybe that is the source of ALL your
problems. :-)
But I don't see why your are fooling around with the MAXES.
That part makes no sense at all to me, since BYTSCL would
do all this on its own.
I don't understand what you are doing to get "the int of
each channel", but perhaps if you get the image planes
in the right order this would be moot.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
|