title: Get pixel coordinates using mouse in cv2 video frame with python
body: <p>I am trying to get the pixel coordinate using the mouse in a video live-feed frame with CV2 and python.</p>
  
  <p>The following is my code:</p>
  
  <pre><code>import cv2      # import the OpenCV library                     
  import numpy as np  # import the numpy library
  
  font = cv2.FONT_HERSHEY_SIMPLEX
  video_capture = cv2.VideoCapture(1)
  
  def mouseHandler(event, x, y, flags, params):
      if event == cv2.EVENT_LBUTTONDOWN:
          print(x, y)
          cv2.circle(frame, (x, y), 3, (255, 0, 0), -1)
  
  
  cv2.setMouseCallback('Video', mouseHandler)
  
  
  while(True):
  
      # Capture frame-by-frame
      _, frame = video_capture.read()
  
      if cv2.waitKey(1) &amp; 0xFF == ord('q'):
          break
      cv2.imshow('Video', frame)
  
  video_capture.release()
  cv2.destroyAllWindows() 
  </code></pre>
  
  <p>But when I run, the frame with the live video appears but no response from left mouse key (or any other key).</p>
  
  <p>Any suggestions appreciated.</p>