Ask Your Question

Revision history [back]

So you already got all the ellipse and you need to filter out four circle at the corners,

Based on the reference link in your question you already have contours with you, Now Filter the contours which close to ellipse,

you could do,

  • Create two binary image of zero pix value, one is to draw contours and another is for draw ellipse.

  • Scan through each contour and draw it to the binary image, at same time draw the ellipse to other binary for corresponding contour, here in both case use CV_FILLED as thickness.

  • Now perform botwise xor between these two binary and count non-zero pixel on the result. If the result is close to zero then the contour is identical to ellipse, else not.

  • Repeat above for every contour and filter out contour close to ellipse, and don't forget to clear the binary image before each contour iteration.