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

Home » Public Forums » archive » how to give specific colour to a pixel on an image
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
how to give specific colour to a pixel on an image [message #90817] Mon, 20 April 2015 09:17 Go to next message
g.nacarts is currently offline  g.nacarts
Messages: 148
Registered: November 2013
Senior Member
Hi

I am using the cgimage function to display my images. I was wondering how can I specify the colour of a pixel location by a particular colour. What I mean is, once I display my image then, the pixel at location [5,8] make it blue. Is that possible?

With Thanks
Re: how to give specific colour to a pixel on an image [message #90818 is a reply to message #90817] Mon, 20 April 2015 12:52 Go to previous messageGo to next message
wlandsman is currently offline  wlandsman
Messages: 743
Registered: June 2000
Senior Member
There is likely a more Coyote-like way of doing this, but I follow two steps:

1. Don't scale the image between 0 and 255 but between, say, 0 and 253, so that the "colored" pixels -- and no others -- can be given the value of 254.
2. Assign the desired color to the lookup table at a location of 254

im = dist(512) ;test image
imscl = bytscl(im,top=253) ;Scale to top value of 253
imscl[5,8] = 254 ;give desired pixel a value of 254

col = cgcolor('magenta',/triple) ;Let's make the pixel magenta
tvlct,col,254 ;Load at 254 in the lookup table

cgimage, imscl ;Now display the image



On Monday, April 20, 2015 at 12:17:08 PM UTC-4, g.na...@gmail.com wrote:
> Hi
>
> I am using the cgimage function to display my images. I was wondering how can I specify the colour of a pixel location by a particular colour. What I mean is, once I display my image then, the pixel at location [5,8] make it blue. Is that possible?
>
> With Thanks
Re: how to give specific colour to a pixel on an image [message #90820 is a reply to message #90818] Tue, 21 April 2015 01:05 Go to previous message
g.nacarts is currently offline  g.nacarts
Messages: 148
Registered: November 2013
Senior Member
Thank you very much! that was very helpful :)
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Function graphics in a widget window
Next Topic: Polar plot centred on magnetic north

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

Current Time: Wed Oct 08 13:37:52 PDT 2025

Total time taken to generate the page: 0.00492 seconds