You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importcv2importnumpyasnp# mouse callback functiondefdraw_circle(event,x,y,flags,param):
ifevent==cv2.EVENT_LBUTTONDBLCLK:
cv2.circle(img,(x,y),100,(255,0,0),-1)
# Create a black image, a window and bind the function to windowimg=np.zeros((512,512,3), np.uint8)
cv2.namedWindow('image')
cv2.setMouseCallback('image',draw_circle)
while(1):
cv2.imshow('image',img)
ifcv2.waitKey(20) &0xFF==27:
breakcv2.destroyAllWindows()
Fails with this error:
Failed to load module "canberra-gtk-module"
Traceback (most recent call last):
File "paint.py", line 12, in <module>
cv2.setMouseCallback('image',draw_circle)
cv2.error: OpenCV(4.3.0) /io/opencv/modules/highgui/src/window_QT.cpp:717: error: (-27:Null pointer) NULL window handler in function 'cvSetMouseCallback'
The text was updated successfully, but these errors were encountered:
this code copied directly from the cv website (https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_gui/py_mouse_handling/py_mouse_handling.html#mouse-handling):
Fails with this error:
The text was updated successfully, but these errors were encountered: