AtillaA
AtillaA

Reputation: 91

Approximate 4 circles inside ellipse to get the radii

I need the approximate radii of the following ellipse. Ellipse I'm working on

The bottom/top and left/right radii should be the same nevertheless need to be checked. Which means 4 radii should be the result of my code. I did the following in paint, the green circle should give me the top radius and red the left (the right and bottom one aren't drawn here). Visualising my idee with paint

The idea I'm working on is to crop the image (left/right/top/bottom side) and approximate circles to the cropped images. With the cv2.findContours-feature some white pixels get recognized as highlighted here.cropped left side

Is there a way to approximate my drawn red circle from above with these given coordinates? The problems I've seen on the internet are all with a given center point or angle which I don't have. Is there a cv2 function that draws circles with only some given coordinates or something similar?

Upvotes: 0

Views: 327

Answers (1)

AtillaA
AtillaA

Reputation: 91

Use this function : cv2.fitEllipse(points) and pass contour points -Ziri

Yes this did the trick. I got the radii after your function with:

(x, y), radius = cv2.minEnclosingCircle(i)

Upvotes: 0

Related Questions