Ask Your Question
0

CV_EVENT_MBUTTONDOWN what does this param mean?

asked 2013-03-05 01:51:53 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >50 is welcome to improve it.

in function CvMouseCallback() one param can be CV_EVENT_MBUTTONDOWN or CV_EVENT_MBUTTONDBLCLK,can anyone explain what does this param mean?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2013-03-05 02:17:38 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >50 is welcome to improve it.

if you register a callback function to your window, CV_EVENT_MBUTTONDOWN is one of the events you can get here ( the 1st param in that function ) maybe you try to run the little test-program below, and just see, what happens ;)

void onmouse( int event, int x, int y, int d, void *p )
{
     cout << event << " " << x << " " << y << " " << d << endl;
     if ( event == CV_EVENT_MBUTTONDOWN ) cout << "middle!" << endl;
}
int main()
{
    VideoCapture cap(0);  // 1st cam
    Mat frame; 
    namedWindow("video", 1);
    cv::setMouseCallback( "video", onmouse );
    for(;;) {
        cap >> frame;
        if(frame.empty()) break;
        imshow("video", frame);
        if(waitKey(30) >= 0) break;
    }   
    return 0;
}
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2013-03-05 01:51:53 -0600

Seen: 705 times

Last updated: Mar 05 '13