how to give specific colour to a pixel on an image [message #90817] |
Mon, 20 April 2015 09:17  |
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   |
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
|
|
|
|