A better idea is to use a special transform to define a circle and ellipses, rather than a general search outline call.
I'm not familiar enough with OpenCV to find out if such a detection exists there - it should be.
An Internet search for a more general “image ellipse detection” shows that this is not a settled issue — unlike squares and rectangles, so everything that OpenCV already contains must be set up. (The basic idea is that the basic algorithm creates a new n-dimensional space where any possible parameterized ellipse for the target image can be represented (for example, the axis for each coordinate of the center x and y, w and h with radii and one for rotation) and fill hits in this matrix in accordance with the contrast of pixels in the target image). Sebastian’s answer names the correct name for this approach, which I couldn’t remember: “Hough Transformation” and provides the necessary links on how it works and how to extend it on OpenCV.
source share