I\'m using cv::minEnclosingCircle(...)
in order to get the minimum circle that exactly evolves my contour, but I\'m getting a circle a little big bigger.
In
My result is OK.
## only one region
cnts = cv2.findContours(threshed, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)[-2]
(x,y), r = cv2.minEnclosingCircle(cnts[0])
## more than one region
mask = threshed.copy()
## find centers
for cnt in cnts:
(x,y), r = cv2.minEnclosingCircle(cnt)
pt = (int(x), int(y))
centers.append(pt)
## connect the `centers`
for i in range(1, len(centers)):
cv2.line(mask, centers[i-1], centers[i], 255, 2)
## find the center
cnts = cv2.findContours(mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)[-2]
(x,y), r = cv2.minEnclosingCircle(cnts[0])