1 | initial version |
I think the problem is CHAIN_APPROX_SIMPLE
. You have a relative straight contour at the upper side, which can be approximated with very few points at the corners of the upper side. So your ellipse fit won't consider this part of contour. Try CHAIN_APPROX_NONE
instead.