04_捕获鼠标事件

僤鯓⒐⒋嵵緔 提交于 2019-11-27 08:23:39

mport cv2
import numpy as np

def draw_circle(event, x, y, flags, param):
if event == cv2.EVENT_LBUTTONDBLCLK:
cv2.circle(img, (x,y), 100, (255,0,0), -1)
img = np.zeros((500, 500, 3), np.uint8)
cv2.namedWindow(‘image’)
cv2.setMouseCallback(‘image’, draw_circle)
while(1):
cv2.imshow(‘image’,img)
if cv2.waitKey(20)&0xFF==27:
break
cv2.destroyAllWindows()

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!