Ask Your Question

Revision history [back]

Use contour finding and bounding rect to get the rectangle of the collection of white pixels. Loop through all pixels in this rectangle. If a pixel is white, compute its distance from the circle center. Change the color of the pixel depending on whether it is less than or greater than he circle radius.

https://docs.opencv.org/3.4/d4/d73/tutorial_py_contours_begin.html