Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

mouse wheel delta

Hi,

I've been using OpenCV 2.x for a few years and have now installed and integrated version 3.2. I'd like to be able to detect and determine the mousewheel direction. I'm not a professional C++ programmer but getting by. Currently, I have callbacks that take care of mouse buttons, CTRL, SHIFT etc. :

 void CallBackFunc(int event, int x, int y, int flags, void* userdata)
 {
    if ( event == cv::EVENT_LBUTTONDOWN) // 
    {
        mouse_click2 = 17;
        mouse_x = x;
        mouse_y = y;
    }

    if ( event == cv::EVENT_LBUTTONUP) // 
    {
        mouse_click2 = 18;
        mouse_x = x;
        mouse_y = y;
    }
 }

etc.....

How do I implement mouse wheel? I read in the documentation that I should use CV_GET_WHEEL_DELTA but no idea how to do this...

I know that:

 if (event == cv::EVENT_MOUSEWHEEL)
 {
   code...
 }

works i.e. it detects a movement of the wheel, but not sure how to measure the direction, or magnitude.

Any code examples would be greatly appreciated!

Thank you in advance.

Jimbo