I would like to find the "inner" circle of a countour calculated in CV2.
Lets assume I have found a contour like the red line in this picture:
It is close to a perfect circle, but in the top-right area it has a "defect". I want to find that defect within that contour. So I can find the min. enclosing circe around that contour via cv2.minEnclosingCircle(contour)
, which results in the blue circle. Now it would be great to also have something like the "opposite", something like the "max. circle within the contour", i.e. the green circle in the image above. Any ideas how to achieve this?
Or is there maybe an easier way to identify a problematic area in the original contour, the one that makes the circle non-perfect?
CodePudding user response:
Ok for the records: I ended up using this approach to calculate the center of a circle with three points from that circle. I do this three times, every times with 120 degrees rotated, so that even if I would "hit" the broken part of the circle once, I do get the correct circle center two out of three times. Then I take those two results that are the same and I am done.