Question

I apologize for my English.

I need to display video frame by frame without tearing with fixed FPS. (Display work in 50p mode and i want to display 50 different frame per second).

I use soft timer, but nothing works (Stroboscope effect).

I use cv::imshow without OpenGL.

Please, tell me what to do?

Was it helpful?

Solution

You can try adding a waitKey(20); call right after imshow. 20 is the number of ms to wait after displaying an image.

Note, however, that waitKey doesn't guarantee it will return right after the 20th ms ends. It guarantees only that it will be running for at least 20 ms.

If you need something more reliable (it may be the case, since your fps is pretty high), you should employ some high precision clock counter. Like clock_gettime on linux. Not sure, but I think on Windows it's QueryPerformanceCounter

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top