Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

WaitKey without waiting?

Is there a way to call WaitKey without incurring a (minimum) 1 millisecond block?

Suppose I have a 300 frames/sec camera & display - to display each frame I need to call waitkey(1) 300 times each second (because you have to call waitkey to get imshow to work), which consumes 30% of my entire CPU.

Most of that time is just sitting there waiting for the keyboard, at 1 ms per call.

This seems like a huge waste of CPU time.

Is there some way to call WaitKey without the needless wait-for-keyboard delay?

WaitKey(0.0000000001) I suppose would do it, but WaitKey only takes integers...