Skip to content

Anti-aliasing error when drawing circles #16308

@bramstoeller

Description

@bramstoeller

When I try to draw an anti-aliased circle in Python 3 (OpenCV 4.2.1.30) the border is incorrect. I have no idea what could have gone wrong... anyone?

img = np.zeros((101, 101), dtype=np.uint8)
cv2.circle(img, (50, 50), 50, 255, cv2.FILLED, cv2.LINE_AA)
cv2.imwrite("circle.png", img)

This is the result (4x zoom), the issue is most noticable at the top and bottom of the circle, but the sides don't look too smooth too...

circle

EDIT: The issue is even clearer in a non-filled circle; it is missing parts of the circumference entirely.

cv2.circle(img, (50, 50), 50, 255, 1, cv2.LINE_AA)

circle

P.S. I'm getting the same result on both Linux and Windows.

Metadata

Metadata

Assignees

Labels

Hackathonhttps://opencv.org/opencv-hackathon-starts-next-week/bugcategory: imgprocconfirmedThere is stable reproducer / investigation complete

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions