Monday, June 8, 2009

with opencv, dont forget cvWaitKey() when grabbing your frames

Currently I program an application in C++ with openCV and brought it together with the QT library. Transforming an example was easy, at least to get it compiled. But the capturing process was not running in its own loop, an update was triggerd regularly by a timer. The result was that I recieved only the first initial frame.

Solution was to reinsert the waiting for key function cvWaitKey with a small value which I removed because it seemed without any use. Now I get all frames...

For instance like this:
IplImage* image =cvQueryFrame( capture );
cvShowImage( "Window", image);



  1. If you are using linux you can use cvStartWindowThread().