comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: display an image from RGB
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: display an image from RGB [message #46773] Mon, 19 December 2005 08:03
chikuei@gmail.com is currently offline  chikuei@gmail.com
Messages: 1
Registered: December 2005
Junior Member
This solution is exactly what I was looking for.

Simple and makes sense to me.

Thanks a lot.

Chi-Kuei

> Or, you can create what is called a "pseudocolor"
> image by using the three (byte scaled) images directly
> as the red, green, and blue channel of a 24-bit image:
>
> IDL> image24 = [ [[Bytscl(R)]], [[BytScl(G]], [[Bytscl(B)]] ]
> IDL> Device, Decomposed=1
> IDL> TV, image24, True=3
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: display an image from RGB [message #46777 is a reply to message #46773] Fri, 16 December 2005 16:50 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Chi-Kuei Wang writes:

> I am an ENVI user. In the context of multi- and hyper-spectral data,
> I always wonder how does ENVI display an image using 3 different
> wavelengths representing red, green, and blue colors.
>
> I am trying to reproduce this function using my own code in IDL (as
> an exercise to understand IDL color table). But I couldn't find a way to
> do it. I suspose I need to know the relationship between (red, green,
> blue) triplets and IDL color table. Say,
> zcolors = red * var_red + green * var_red + blue * var_blue
> Once I know this relationship, I can use it to generate a new image,
> whose pixel values will correspond to IDL color table.
>
> Is this correct? If so, can anyone provide me the relationship for
> color triplets and IDL color table.

I don't have any idea how ENVI does this, but I think you
have a couple of choices. You can take your three images
(call them R, G, and B) and create a flat 2D gray-scale image
that you can display with any color table you like. A typical
formula for creating a gray-scale image that preserves color
"sensitivity" is this:

IDL> Y = 0.3*R + 0.59*G + 0.11*B
IDL> LoadCT, 22
IDL> Device, Decomposed=0
IDL> TV, BytScl(y)

Or, you can create what is called a "pseudocolor"
image by using the three (byte scaled) images directly
as the red, green, and blue channel of a 24-bit image:

IDL> image24 = [ [[Bytscl(R)]], [[BytScl(G]], [[Bytscl(B)]] ]
IDL> Device, Decomposed=1
IDL> TV, image24, True=3

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: display an image from RGB [message #46778 is a reply to message #46777] Fri, 16 December 2005 13:43 Go to previous message
Jean[1] is currently offline  Jean[1]
Messages: 8
Registered: November 2005
Junior Member
> I suspose I need to know the relationship between (red, green, blue)
> triplets and IDL color table. Say,
> zcolors = red * var_red + green * var_red + blue * var_blue
> Once I know this relationship, I can use it to generate a new image,
> whose pixel values will correspond to IDL color table.

look for rgbtoidx.pro in ftp://ftp.rsinc.com/training/IDL_intro/intro.zip

Jean
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Comment/uncomment keyboard shortcut?
Next Topic: Cursor in IDL under Mac OSX 10.4

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:49:13 PDT 2025

Total time taken to generate the page: 0.00599 seconds