I get this result when fitting an ellipse to a contour (the contour is green, the fitted ellipse in blue)
Here's the original image :
Why doesn't it fit? Here is the code :
img1 = cv2.imread(r'limb_edge_fl28_iss3628.jpg')
gray1 = cv2.cvtColor(img1, cv2.COLOR_BGR2GRAY)
Threshold the images
thresh1 = cv2.threshold(gray1, 127, 255, cv2.THRESH_BINARY)[1]
contours = cv2.findContours(thresh1.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE)[1]
cnt1 = contours[0]
draw contours found
cv2.drawContours(img1, [cnt1], 0, green, 2)
Fit an ellipse to the contours
ellipse = cv2.fitEllipse(cnt1)
Draw the ellipse on the image
cv2.ellipse(img1,ellipse,(255,255,0),2)
cv2.imshow("ellipse fit 1", img1)