# 双击的时候画一个圆import cv2
import numpy as np
# mouse callback functiondefdraw_circle(event, x, y, flags, param):#参数一个不能少if event == cv2.EVENT_LBUTTONDBLCLK:#左键双击
cv2.circle(img,(x, y),100,(255,0,0),-1)# Create a black image, a window and bind the function to window
img = np.zeros((512,512,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()
# 列出所有可用的事件,执行下面的代码:import cv2events = [i for i in dir(cv2) if 'EVENT' in i]#dir() 函数不带参数时,返回当前范围内的变量、方法和定义的类型列表;带参数时,返回参数的属性、方法列表。print(events)['EVENT_FLAG_ALTKEY', 'EVENT_FLAG_CTRLKEY', 'EVENT...