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.
|