I have an image which I define like the following:
img = np.zeros(474,474)
I would like to draw true filled circles and not polygonal approximations of circles on this image at different coordinates as centre and of a fixed radius. For example, I want to draw two circles with centres (100,200)
and (150,372)
with radius 2
pixels. What I am expecting is that after plotting the circles, the entries of the original image img
should change to all ones where the circle is present.
I tried opencv cv.circle
module as well as skimage.draw.circle
module but they generate some polynomial approximation of circle.
I was also trying the following in matplotlib
but I don't seem to understand how to plot it on my image img
.
Any help would be appreciated.
from matplotlib.patches import Circle
img=np.zeros(474,474)
fig = plt.figure()
ax = fig.add_subplot(111)
centers = [(100,200),(150,372)]
for i in range(len(centers)):
Circle((centers[i][0],centers[i][1]), radius= 2)