[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
that
they are contiguous - i.e., so that they are ordered in such a way that
if
you used 'plots,/dev,xvals,yvals' on this set of xvals and yvals, they
would
follow the edges of a given polygon as if you were drawing it with a pen
on
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
this
on your image immediately, then you can set up a test image that has
this
information in it - that is, simplify your image so that it contains a
single
polygon with known pixel coordinates in order.
2) Given this list of pixels, compute the slope of the line containing
each
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
in
the array theta_vals whose difference (in absolute value) exceeds some
threshold
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