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