Ask Your Question
1

Opencv_how to catch event

asked 2013-04-05 04:54:03 -0600

Vuong Bui gravatar image

How to catch event keyboard when i keypress on cvNamedWindow in opencv

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2013-04-05 05:05:32 -0600

Vladislav Vinogradov gravatar image

use cvWaitKey function:

cvNamedWindow("window")
for(;;)
{
    char key = (char) cvWaitKey(10);
    if (key == 27 /*escape*/)
        break;
}
edit flag offensive delete link more

Comments

And to add to this, if you add cvWaitKey(0) then it will wait forever on a single key. Do know that the function can only exist if at least a single namedWindow is defined in your code.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-04-05 06:56:06 -0600 )edit

thanks you

Vuong Bui gravatar imageVuong Bui ( 2013-04-05 11:44:03 -0600 )edit

Question Tools

Stats

Asked: 2013-04-05 04:54:03 -0600

Seen: 220 times

Last updated: Apr 05 '13