nvcnvn
nvcnvn

Reputation: 5175

How to detect corner with specific angle degree

I have an image with a equilateral triangle and a rectangle:
equilateral triangle and a rectangle
And I want to detect 3 corner of the triangle only. I follow the OpenCV Harris corner detector tutorial I see that all the corner-point of the triangle have the threshold = 80 (when all the 4 corner-point of the rectangle threshold = 255). But I did not find the link between threshold and degree.

How can I find the corner that in the range of [55,65] degree, for example?
Here is the output Mat http://pastebin.com/raw.php?i=qNidEAG0

P/s: I very new to CV, hope you can give some more detail!

Upvotes: 11

Views: 9751

Answers (1)

Rasim
Rasim

Reputation: 1296

It seems that I found possible solution. I've implemented it on Mathematica and able to explain basic steps.

  1. Use find corners operator and take strongest corners. Use Harris operator. Corners
  2. Find contours (cv::FindContours).

    Contours

  3. For each corner in each contour draw a circle and find point of intersection between circle and contour. There is no ready function for it in OpenCV and you should implement it yourself.

    Intersections

  4. Now for each corner you have coordinates of three points: corner, and two points on sides of contour. It is enough to evaluate angles using dot product:

    angle estimation

Result:

Corners found

Upvotes: 12

Related Questions