I just drew two red circles with matplotlib,the first one’s radius is 0.25,the second is 0.5.There is no doubt that the ratio of the area of ​​the former to the latter is 0.25.I have used the CV2 to count the red pixels of each circle in HSV(converted from RGB),However,the pixels of fomer is 8753,the latter is 29718,which means the ratio of the area is about 0.2945. Why this happened,and how do I solve this problem. Here is my code,sorry if my text is formatted incorrectly,I’m a fresh guy here.

``````from matplotlib.patches import Circle
import matplotlib.patches as patches
import matplotlib.pyplot as plt
import numpy as np
import cv2
import numpy as np
fig = plt.figure();
cir2 = Circle(xy=(0, 0), radius=0.25, color='red', alpha=1.0)
plt.axis('scaled')
ax.set_xlim(-1, 1)
ax.set_ylim(-1, 1)
plt.axis('equal')
ax.set_aspect(1)
plt.savefig('testblueline{name1}.jpg'.format(name1='1'))
img_name="testblueline1.jpg"
img_hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)
# Merge the mask and crop the red regions
Try setting `Circle(..., lw=0, ...)`.