[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Repost of Vertex question...

>       I would love to be able to use IDL to find the vertices in this
> image.
>       Essentially this will give me all the corners in the image.  Is
> there a
>       function in IDL that does such a thing (find intersections or
> verticies)?

Here's an idea that might get you started. 

1) Find a way to sort the pixels that contain the 'line' information so
they are contiguous - i.e., so that they are ordered in such a way that
you used 'plots,/dev,xvals,yvals' on this set of xvals and yvals, they
follow the edges of a given polygon as if you were drawing it with a pen
the screen - there are several ways of doing this, but the details
depend on
the nature of your images, so I leave this part to you. If you can't do
on your image immediately, then you can set up a test image that has
information in it - that is, simplify your image so that it contains a
polygon with known pixel coordinates in order.

2) Given this list of pixels, compute the slope of the line containing
contiguous pair of pixels - something like
	theta_vals = atan(yvals-shift(yvals,1), xvals-shift(xvals,1))
(syntax is close but may not be perfect here)

3) Now you can search for vertices by defining them as successive values
the array theta_vals whose difference (in absolute value) exceeds some
level. You may have some wrap-around modulo two-pi problems when theta
goes between
0 and 2*!pi, but this is the general idea.

If you have a very low resolution image, this approach might not work
very well,
due to the granularity of the pixel locations, but it is a start. If you
are only
after vertices with very sharp angles, though, this might be close to
what you want.

Hope this sparks some ideas from others,

Dick French
Astronomy Dept, Wellesley College