import cv2
def CircleCallback(event, x, y, flags, param):
if event == cv2.EVENT_LBUTTONDBLCLK: # 双击鼠标绘制圆
cv2.circle(img, (x,y), 200, (255,69,0), 20)
print('圆心坐标:x = {0}, y = {1}'.format(x, y))
elif event == cv2.EVENT_RBUTTONDOWN: # 单击鼠标右键绘制矩形
cv2.rectangle(img,(x,y),(1000+x,1000+y),(255,20,147),thickness=5)
elif event == cv2.EVENT_LBUTTONDOWN: #单击鼠标左键绘制线
cv2.line(img,(x,y),
Opencv-Python鼠标响应事件之绘制圆/矩形/线/椭圆
于 2021-06-17 11:10:45 首次发布