Reputation: 5148
I'm trying to get corners that are formed by two approximately perpendicular line segments, and not all the possible corners that are detected by either Shi-Tomasi or the Harris corner detectors provided in OpenCV.
Eg:
000000000000000110
000000000000001100
000000000000011000
000000000000110000
000000000001100000
111111111111111111
000000000000000000
000000000000000000
Something like the above would generate a corner as required - the two lines are close enough to being perpendicular.
However, here's what I'm trying to avoid:
000000000000000000
000000000000001111
000000000011110000
111111111100000000
000000000000000000
Here the lines are definitely not nearly-perpendicular however there's no argument to specify a threshold angle to the detectors. Is there any way to implement this using OpenCV? If not, then resources that point how to code one from scratch using C/C++ would be really helpful.
FURTHER DETAILS: This came up while trying to implement offline sketch interpretation - the "Corner Detection" portion from this paper.
Upvotes: 2
Views: 1059
Reputation: 21932
Are there many such lines/corners in your image? One thing I can think of is to try a Hough transform to get all the lines first, then examine the angles between line pairs.
Upvotes: 1