Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SetMouseCallback not working #537

Closed
claudeHasler opened this issue Sep 26, 2018 · 1 comment
Closed

SetMouseCallback not working #537

claudeHasler opened this issue Sep 26, 2018 · 1 comment
Labels
bug Something isn't working

Comments

@claudeHasler
Copy link

claudeHasler commented Sep 26, 2018

Summary of your issue

Im trying to select a ROI by mouse input. I wish to get the pixel coordinates by means of a mouseCallback, however the mouseCallback never seems to be called. Other callbacks such as trackbar seems to work just fine.

Environment

Visual Studio 2017 WPF

Example code:

    public void getMouseClickCoordinates(MouseEvent e, int x, int y, MouseEvent f)
    {
        System.Windows.MessageBox.Show("im a callback");
    }

    public void trackbarCallback(int pos, object userdata)
    {
        System.Windows.MessageBox.Show("im a trackbarcallback");
    }


    public MainWindow()
    {
        InitializeComponent();
    }

   int bla = 5;

    private void Button_Click(object sender, RoutedEventArgs e)
    {


        Mat mat;
        mat = Cv2.ImRead("C:\\Users\\Master\\Desktop\\img.png");
        Cv2.NamedWindow("myWindow");


        
        
        Cv2.CreateTrackbar("myTrackbar", "myWindow", ref bla, 0, new 
        CvTrackbarCallback2(trackbarCallback));

        Cv2.SetMouseCallback("myWindow", new CvMouseCallback(getMouseClickCoordinates));

        Cv2.ImShow("myWindow", mat);
        Cv2.WaitKey(2000);


        

    }
@shimat shimat added the bug Something isn't working label Nov 1, 2018
@shimat
Copy link
Owner

shimat commented Nov 1, 2018

Thanks 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants