The deceptively name OpenCV cv::waitKey in OpenCV is the centre of any use of the highgui module. This module makes it easy to create simple user interfaces and the waitKey function, in addition to waiting for keyboard events, is responsible for updating the message pump for all the windows.
The prototype of the function is:
int cv::waitKey(int mills);
Where millis is the amount of time to wait. If millis is 0 the functions waits until a key is pressed. Otherwise, if millis is greater than 0 the function will return the keycode for the pressed key (a …