## How can I find the angle of the curves marked in the picture below? - opencv

### Difference Between Hough Circle and minEnclosed Circle in OpenCV to detect circles?

```I just want to know what will the difference be if instead of using hough circle to detect a circle, I find a contour and using minEnclosed circle find the circle? Which one will be more accurate? As far as I can understand both of them should give me the same thing. Can anyone help clarify
```
```minEnclosed circle will enclose all outlier points in your connected component (blob or edge) while Hough circle searches for the best fit using voting algorithm.
So for searching circles; Hough circle is more accurate.
Edit :```

### Is it possible to perspectivetransform an ellipse into a circle?

```For a project, I need to store circles detected on some photos. The problem is that some of these photos are taken from an angle, meaning the circles are ellipses. Is it possible to somehow turn the ellipses into circles?
I thought of rectifying the ellipse, then transforming the rectangle to a square. Indeterminate problem comes to my mind, meaning there are too many possible variations for my approach, and the results are different for each approach.
```
```To find perspective transform, you need to have 4 pairs of corresponding coordinates: points at distorted picture and their ideal positions after correction of perspective.
In this case you can calculate matrix of perspective transform with getPerspectiveTransform function and apply it to correct all the picture. Example```

### Constrained Hough transform for line detection

```I need to detect straight lines (ridges) in an image where I known in advance their direction (to some tolerance).
I am using OpenCV and the HoughLines function.
Is there a way to limit the detection to those lines by
only using edges pixels that have a gradient direction quasi-perpendicular to the desired direction,
restricting the accumulation and search to a small range of angles.
I couldn't find such options in OpenCV 3.0
A typical image:```

### How to detect corner with specific angle degree

```I have an image with a 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!
```
```It seems that I found possible solution. I've implemented it on Mathematica and able to explain basic steps.
Use find corners operator and take strongest corners. Use Harris operator.
Find contours (cv::FindContours).
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.
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:
Result:```

### OpenCV - Find skewed rectangle

```I want to draw a "bounding box" around a skewed rectangle. I thought I could use the cvMinAreaRect2() function but it only handles the rotation, see this image:
Is there any function to solve this?
If not, any ideas how to implement it?
```
`Compute both MinAreaRect and ConvexHull. Then, for each of the four points found by MinAreaRect, find the corresponding nearest point in the convex hull.`