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

Home » Public Forums » archive » Color table question
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Color table question [message #436 is a reply to message #435] Mon, 10 August 1992 16:59 Go to previous messageGo to previous message
thompson is currently offline  thompson
Messages: 584
Registered: August 1991
Senior Member
In article <1992Aug10.223854.14071@news2.cis.umn.edu>,
patel@sparky.drad.umn.edu () writes...

> In PV-WAVW, I need to display a gray scale image(256 grays). I need
> few colors for graphics. I did the following to accomplish this:
>
>
> loadct,0 ; load a gray scale color table.
> ; Load the color table with 7 colors.
> Tvlct, 140, 140, 140, 1
> Tvlct, 130, 140, 220, 2
> Tvlct, 90, 80, 160, 3
> Tvlct, 255, 255, 255, 4
> Tvlct, 200, 200, 60, 5
> Tvlct, 50, 170, 80, 6
> Tvlct, 200, 70, 70, 7
>
> ; Byte scale the image in 'im'
> imb=bytscl(im)
> ;to avoid funny colors in the image, set all pixels with value <10 to 10
> imb(where(imb lt 10))=10
> tvscl,imb
> end
>
>
> with this segment of the program, I donot expect to see any colors
> in my image. But I do see scattered pixels with different colors.
> What am I doing wrong here.

First of all, since you've already scaled the image with BYTSCL, you don't need
to rescale it with TVSCL. Use TV instead. Also, you don't need to go to all
that much trouble to make sure that the scaled image has no values <10; you can
simply say

imb = bytscl(im) > 10b
tv, imb

Even better would be to scale the image to exactly the number of colors
available after reserving the 10 colors you're using elsewhere. At the same
time, we can also take care of the fact that your display may have less than
256 colors available:

imb = bytscl(im,top=!d.n_colors-11) + 10b
tv, imb

In fact, you simplify this to one line

tv, bytscl(im,top=!d.n_colors-11) + 10b

Bill Thompson
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Any update on OS X
Next Topic: Speedup in Object Graphics

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

Current Time: Wed Oct 08 19:11:35 PDT 2025

Total time taken to generate the page: 0.00486 seconds