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

Home » Public Forums » archive » Re: hieghlighting pixel
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
Re: hieghlighting pixel [message #71088] Thu, 27 May 2010 07:37
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
On May 27, 9:59 am, Bennett <juggernau...@gmail.com> wrote:
> On May 27, 12:56 am, afzal <afzal....@gmail.com> wrote:
>
>> in my work  i need  to highlight some points(pixels) of binary image
>> with some color(eg:-red). cud anybody help me to do this
>> thanking you
>> afzal
>
> The plotting method also allows you to highlight different pixels of
> interest with many different colors.

Yep, that's what I do.
Craig
Re: hieghlighting pixel [message #71091 is a reply to message #71088] Thu, 27 May 2010 06:59 Go to previous message
Juggernaut is currently offline  Juggernaut
Messages: 83
Registered: June 2008
Member
On May 27, 12:56 am, afzal <afzal....@gmail.com> wrote:
> in my work  i need  to highlight some points(pixels) of binary image
> with some color(eg:-red). cud anybody help me to do this
> thanking you
> afzal

The plotting method also allows you to highlight different pixels of
interest with many different colors.
Re: hieghlighting pixel [message #71092 is a reply to message #71091] Thu, 27 May 2010 06:58 Go to previous message
Juggernaut is currently offline  Juggernaut
Messages: 83
Registered: June 2008
Member
On May 27, 8:11 am, David Fanning <n...@dfanning.com> wrote:
> afzal writes:
>> in my work  i need  to highlight some points(pixels) of binary image
>> with some color(eg:-red). cud anybody help me to do this
>> thanking you
>
> Scale your image into some number of values less
> that 256, then use these "extra" values for your
> colors.
>
>    image = dist(200)
>    scaledImage = BytScl(image, Top=250)
>
> Now, load your colors appropriately. For example,
> your scaled image now has 251 values (0 to 250),
> so the color table is loaded like this:
>
>    LoadCT, 0, NColors=251
>
> Next, load your drawing color. Red in this case,
> at color index number 251:
>
>    TVLCT, 255, 0, 0, 251
>
> Now, select your pixels that will be red:
>
>    indices = Where(image gt 75 and image lt 85, count)
>    IF count gt 0 THEN scaledImage[indices] = 251
>
> Then, just display your image:
>
>    TVImage, scaledImage, /NoInterp, /Keep_Aspect
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")

Another option is simply to plot them onto the image. Figure out
which pixels you want to highlight and do the following.
xSize and ySize will be the size of the window you are working
with..making sure that the window fits the data by some integer
multiple
For example if my image size was 200x312 and you made a window to
display it in, it should be something like 400x624
xSize = 400, ySize=624
Then you would just multiply your x and y subscripts that you found
and wanted to highlight by the zoom factor (2 in this case)
plot, [0], [0], xmargin=[0,0], ymargin=[0,0], xrange=[0,xSize-1],
yrange=[0,ySize-1], /noerase, /nodata, ystyle=5, xstyle=5
oplot, xInds*2, yInds*2, color=fsc_color('red'), psym=6, symsize=0.15

Voila, you now will have red pixels where you want them and the rest
will remain white or black.
Re: hieghlighting pixel [message #71094 is a reply to message #71092] Thu, 27 May 2010 05:11 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
afzal writes:

> in my work i need to highlight some points(pixels) of binary image
> with some color(eg:-red). cud anybody help me to do this
> thanking you

Scale your image into some number of values less
that 256, then use these "extra" values for your
colors.

image = dist(200)
scaledImage = BytScl(image, Top=250)

Now, load your colors appropriately. For example,
your scaled image now has 251 values (0 to 250),
so the color table is loaded like this:

LoadCT, 0, NColors=251

Next, load your drawing color. Red in this case,
at color index number 251:

TVLCT, 255, 0, 0, 251

Now, select your pixels that will be red:

indices = Where(image gt 75 and image lt 85, count)
IF count gt 0 THEN scaledImage[indices] = 251

Then, just display your image:

TVImage, scaledImage, /NoInterp, /Keep_Aspect

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: hieghlighting pixel [message #71097 is a reply to message #71094] Thu, 27 May 2010 00:25 Go to previous message
rogass is currently offline  rogass
Messages: 200
Registered: April 2008
Senior Member
Small correction:

showresultonly=1; or 0 to keep the new result
red=255b
green=0b
;green=255b & blue=0b if you want to show 0's in green
blue=255b
;to show only the condition in red you have to set green and blue to
0b
result=[[[red*image]],[[green*(~image)]],[[blue*(~image)]]]
tvscl, showresultonly? temporary(result) : result,true=3
;shows 1's in red and 0's in blue according your condition

:)

CR
Re: hieghlighting pixel [message #71098 is a reply to message #71097] Thu, 27 May 2010 00:20 Go to previous message
rogass is currently offline  rogass
Messages: 200
Registered: April 2008
Senior Member
On 27 Mai, 06:56, afzal <afzal....@gmail.com> wrote:
> in my work  i need  to highlight some points(pixels) of binary image
> with some color(eg:-red). cud anybody help me to do this
> thanking you
> afzal

This will be difficult, because a binary image only has 0's and 1's.
You have to transform the image, e.g.:

tv,[[[255b*((ff=dist(256) gt 100.))]],[[255b*(ff eq 0b)]],
[[255b*(temporary(ff) eq 0)]]] ,true=3

or maybe in your case:

showresultonly=1; or 0 to keep the new result
condition = image eq 1; or 0 if you want to highlight the 0's
red=255b
green=0b; 255b if you want to show 0's in green you must also set blue
to 0b
blue=255b
; to show only the condition in red you have to set green and blue to
0b
result=[[[red*condition]],[[green*(~condition)]],
[[blue*(~temporary(condition))]]]
tvscl, showresultonly? temporary(result) : result,true=3 ; shows 1's
in red and 0's in blue according your condition

Hope it helps

CR
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: IDLDE can not start in Ubuntu10.04
Next Topic: Re: Integrator taking vectors as input?

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

Current Time: Wed Oct 08 13:43:08 PDT 2025

Total time taken to generate the page: 0.00674 seconds