Page 1 of 1

detect or find right angle in an image

Posted: 2010-11-09T13:06:16-07:00
by daffy
Hi

Is there a way to find 90 degree (or intersecting lines) within an image?

i have an image with two lines (intersecting and making a right angle), i would like to crop all image that falls under right angle area.

thanks

Re: detect or find right angle in an image

Posted: 2010-11-09T17:16:11-07:00
by anthony
That can be tricky. Especially if the right angle can be rotated and at different scales (how long are the two lines). The first step would be appropriate cleanup of the image to remove extraneous detail that would only confuse what you are looking for.

The Hough Algorithm will find lines, though not intersections of those lines.

A Scale/Rotate/Translation invariant image search method, used against a edge detected image may also be a possibility. That is create a edge detection image, then transform it into a polar-log image before looking for the 'signature' pattern of the desired right angle.

The Raster to Vector translator, "AutoTrace" also has options in it about angle join limits for determining if a line should be a sharp angle or a smooth curve. That may also yield something useful, as it must then also know if two lines (edges) actually do form a right angle, and how much of a right angle. However this only works well on images with large areas of solid color, which may be difficult to generate.

However I am sure quite a number of other methods exist in an area I am not really familiar with... Image Registration. That is the location of specific types of points in an image, that can then be used to match up to similar points in a second image. One of the registration techniques is line intersections and corners. So I am sure it has something like what you are looking for. Do a google on that and see what you can find.

Oh an please let us know what you did find that is useful. It would be something like this would be useful in many other programs, and scripts. It may even be able to build into IM core library!

Re: detect or find right angle in an image

Posted: 2010-11-16T10:05:24-07:00
by daffy
thanks for the input!
I will give that some try and let you know.

another simple question i have is,

while looking for lines, could i specify length of the line (during edge detection) ?
i would like to detect edge only if its length is X and ignore all other edges.

Re: detect or find right angle in an image

Posted: 2010-11-16T11:33:22-07:00
by fmw42
IM has nothing that I know about that will measure and filter edges by length (as they need to be connected into lines first). IM edge detection only looks for discontinuities in grayscale (color) in a local or pixel neighborhood. You probably need to write something yourself. See all the details of such processing by Googling for Canny Edge Detector.

It would be nice if someone would contribute code to IM for either or both a Hough Line Transformation and a Canny Edge Detector.