tackmeister@gmail.com writes:
> The past few months I've been breaking my head on a particular problem. I try to create RGB images using the image function. My array to plot is three dimensional, an example image would be:
>
> a=fltarr(500,500,3)
> for i=0,499 do if i lt 300 and i gt 200 then a(i,*,0)=i
> for i=0,499 do if i lt 300 and i gt 200 then a(*,i,0)=i
> for i=0,499 do if i lt 100 and i gt 0 then a(i,*,1)=i
> for i=0,499 do if i lt 100 and i gt 0 then a(*,i,1)=i
> for i=0,499 do if i lt 500 and i gt 400 then a(i,*,2)=i
> for i=0,499 do if i lt 500 and i gt 400 then a(*,i,2)=i
>
> I plot this array using:
> graph = image(a)
>
> The problem now is that every pixel with value (0,0,0) as (R,G,B) will be plotted black. Personally, I'd prefer it if the scaling would occur from white to black instead of the other way around (by default).
>
> I tried to change the color table used, yet this doesn't work. The only thing that does help is by inverting the bytscled array, yet this inverts the entire color table and gives strange looking color. Using the tv procedure instead of the image function also doesn't help.
>
> In any case, does anyone of you have an idea how I can image my 3D array as an RGB image, scaled from white (lowest intensity) to black (highest intensity)?
Huh!? There is no color table here. You are specifying the colors
directly. If you want a pixel with a RGB value [0,0,0] to be plotted
white, then you have no choice but to change its value to [255,255,255].
A color table, ANY color table, is useless to you!
Actually, your colors are worthless to you too, since the values in the
array are ranging from 0 to 400, and color values in an RGB triple can
only range from 0 to 255.
You seem to know what colors you want. Just find the RGB value for that
color and assign those values to the pixels you want to be that color.
Simple as that.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|