Re: Color table question [message #433 is a reply to message #427] |
Tue, 11 August 1992 03:13  |
hofer
Messages: 16 Registered: April 1991
|
Junior 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.
> Thanks for your help.
>
> Maqbool Patel
> patel@hippy.drad.umn.edu
Use `tv' instead of `tvscl' to plot the image. `tvscl' scales the image into
the range 0..255, so all pixels with the value 10 in `imb' will become 0.
BTW, wouldn't it be more sensible to scale your data linear between 10 and 255
instead of setting all values <10 to 10. So I would use:
; Byte scale the image in 'im' to the range 10..255
imb = bytscl(im, TOP=245) + 10B
; dump the image to the screen
tv, imb
Hope this helps.
Remo Hofer
--
RFC822: <hofer@urz.unibas.ch> or <hofer%urz.unibas.ch@CERNVAX.BITNET>
X.400: S=hofer;OU=urz;O=unibas;P=SWITCH;A=ARCOM;C=CH
HEPNET/SPAN: CHGATE::YOGI::HOFER or 20579::48130::HOFER
|
|
|