Ask Your Question
0

Mouse events in a mac?

asked 2015-04-12 01:28:20 -0600

Hardin gravatar image

Hello and thanks always.

I have written this very simple python program:

import 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)

#create a black image, a windows and bind the fuction to the window

img=np.zeros((512,512,3),np.uint8)
cv2.namedWindow('image')
cv2.circle(img,(10,10),10,(0,255,0),-1)
cv2.setMouseCallback('image',draw_circle)

while(1):
    cv2.imshow('image',img)
    if cv2.waitKey(20)&0xFF==27:
        break

cv2.destroyAllWindows()

And although I have tested it on a windows machine and works without problems when I tried it on my mac, all I got is a black window and the program does not seem to respond to the mouse or pad commands.

What is my mistake here? Can anyone help me on this

Thanks a lot

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2015-08-29 12:31:41 -0600

zyyw gravatar image

I have the same issue on Mac OS X, 10.10.3

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-04-12 01:28:20 -0600

Seen: 1,427 times

Last updated: Apr 12 '15