How to Create a simple application which draw a circle on an image wherever you click on it.
import cv2 import numpy as np black_image = np.zeros((500, 700, 3), np.uint8) def draw_circle(events, x, y, flags, param): if events == cv2.EVENT_LBUTTONUP: cv2.circle(black_image, (x, y), 90, (0, 0, 255), 3) cv2.namedWindow('window') cv2.setMouseCallback('window', draw_circle) while True: cv2.imshow('window', black_image) if cv2.waitKey(1) == 27: breakcv2.destroyAllWindows()
Comments
Post a Comment