Skip to content

MouseCallback requires existing window to work #15

@MatusGasparik

Description

@MatusGasparik

Hey Alexander,
I'm trying to use your library to work with OpenCV in a way that feels more pythonic.
I am having problems getting the MouseCallback to work. Here a simple example:

import cv2
from pcv.vidIO import VideoReader
from pcv.interact import MouseCallback

def on_mouse_click(event, x, y, flags, params=None):
    if event == cv2.EVENT_LBUTTONDOWN:
        print("Click", x, y)

window = 'foo'
with VideoReader("my_video.mp4", display=window) as vid:
    vid.stream(mouse_handler=MouseCallback(window, on_mouse_click))

But, I don't get any outputs. Is there some I should be doing differently or is this a bug?

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentation

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions