Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 343
nvcnvn Avatar asked Apr 05 '13 16:04

nvcnvn


People also ask

How do you find a corner?

Moravec corner detection algorithmThe similarity is measured by taking the sum of squared differences (SSD) between the corresponding pixels of two patches. A lower number indicates more similarity. If the pixel is in a region of uniform intensity, then the nearby patches will look similar.

How does the Harris corner detector work?

The Harris corner detector works by taking horizontal and vertical derivatives of the image and looking for areas where both are high, this is quantified by the Harris corner descriptor which is defined in our case as the matrix �and the descriptor is .

Why is the Harris corner detector effective?

Compared to the previous one, Harris' corner detector takes the differential of the corner score into account with reference to direction directly, instead of using shifting patches for every 45 degree angles, and has been proved to be more accurate in distinguishing between edges and corners.

What is K cosine algorithm?

detection method that achieves robust detection for digital objects containing wide angles and various curves using curvature. The boundary of an object is first represented into curvature measured by K-cosine.


1 Answers

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

like image 67
Rasim Avatar answered Sep 17 '22 04:09

Rasim