How to use Mouse Clicks to draw Circles in Python using OpenCV — Easy Project

Let’s do it…

import cv2
import numpy as np
black_image = np.zeros((512,512,3),np.uint8)
cv2.imshow(‘Black Image’, black_image)
def draw_circles(event,x,y,flags,param):
if event==cv2.EVENT_LBUTTONDOWN:,(x,y),40,(255,255,255),-1)
# draw circles
while True:
if cv2.waitKey(1)==27:



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store