Re: CURSOR skips a few beats :-( [message #69626 is a reply to message #69624] |
Thu, 28 January 2010 17:57   |
penteado
Messages: 866 Registered: February 2018
|
Senior Member Administrator |
|
|
On Jan 28, 8:38 pm, Gianguido Cianci <gianguido.cia...@gmail.com>
wrote:
> Right, you can join the dots... so when IDL plots the line between the
> dots, it calculates which pixels need to turn white. How do I get the
> coords of all those pixels?
You can do it with an ROI:
;make up some x,y pixel coordinates
dims=[200,200]
x=randomu(seed,10)*dims[0] & x=x[sort(x)] & x=[x,reverse(x)]
y=(1d0+([randomu(seed,10),-randomu(seed,10)]))*dims[1]/2
;take look at the points
iplot,x,y
;define an ROI with those vertices
oroi=obj_new('idlanroi',x,y)
;get the pixels that lie on the boundary
bound=oroi->computemask(dimensions=dims,mask_rule=0)
;take a look at the result
iimage,bound
;get the coordinates of the boundary pixels
w=where(bound eq 255B)
xy_bound=array_indices(bound,w)
|
|
|