0

I need some help with defining the "outer" corner points of a set of detected corner points.

I have implemented hough transform in javascript, to detect lines in an image with a perspective-deformed rectangle. After some filtering, the most plausible lines are left, and I calculated their points of intersection. The result is that I have a set of points, that COULD be a corner of the recognised perspective-deformed rectangle (see image): multiple lines with multiple intersection points.

What I want to do right now, is decide on the actual corner point, by checking which one is the most "outer" corner of the perspective-deformed rectangle. With outer corners I mean the corners that we, humans, would perceive as "most top left" or "most bottom right".

I already tried getting the shape's corner points that are closest to the image corners, but these are not always the most "outer" corners because of extreme cases of perspective.

  • detected lines are almost never parallel
  • image is user input, so position, rotation and perspective of the deformed rectangle can be anything

Intersection points of multiple detected lines

2 Answers2

0

I think a convex hull can solve this problem, as Mbo said in the comments.

0

You can build convex hull to diminish a number of potential corner points.

enter image description here

MBo
  • 77,366
  • 5
  • 53
  • 86
  • I did this. My final solution (which seems to be the best one for my case) is to calculate the centroid of the convex hull, and then take the four points that are the farthest from the centroid. Thanks. – Stef van Wijchen Apr 28 '17 at 08:13