11

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!

user1803551
  • 12,965
  • 5
  • 47
  • 74
nvcnvn
  • 4,991
  • 8
  • 49
  • 77

1 Answers1

12

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

Rasim
  • 1,276
  • 1
  • 11
  • 24
  • For the first step, you mean is find all the local maxima of the result form the *cv::cornerHarris*? – nvcnvn Apr 06 '13 at 15:26
  • Great solution! I think that the easiest way to find points of intersections in point 3 is to draw circles on empty (blank) image and the use & operator on this image and on image of contours. The result should be all points of intersections. – cyriel Apr 07 '13 at 01:57
  • This didn't works when distance between contours is less than circles radius. In this cases you get a lot of false intersections. – Rasim Apr 07 '13 at 09:48
  • @brotherofken - yo are right, but it's easy to fix - just draw each circle on separate image or find the smallest distance between corners and use smaller radius. – cyriel Apr 07 '13 at 22:21