As the title says, I am trying to fix the jagged edges around the circle I created in OpenCV.
I've tried a few things i.e. cv2.blur(), cv2.filter2D(), they didn't do the trick.
import numpy as np
import cv2
import random
for i in range(5):
img = np.zeros((512,512,3), np.uint8)
H = random.choice(list(range(100,500)))
V = random.choice(list(range(100,500)))
S = random.choice(list(range(30,150)))
cv2.circle(img,(H,V), S, (0,0,255), -1)
img = cv2.resize(img,(750,750))
f = (3-len(str(i)))*'0'+str(i)
cv2.imwrite('circle%s.jpg' % f, img)
cv2.destroyAllWindows()

I think you are looking to draw an antialiased outline. You can do that by setting the lineType parameter:
cv2.circle(img,(H,V), S, (0,0,255), -1, lineType=cv2.LINE_AA)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With