Sir said waitkey(0) waits for 0 ms?

Or infinite time…so thats fine but later in the video sir said that it quits when any key is pressed , I didn’t understand that part.

Hello @nikhil_sarda,

cv2.waitKey(t) waits for an input for t milliseconds and returns if no key is pressed in that duration.
So, if you do, cv2.waitKey(10), it will wait for 10ms and return if no key is pressed or return the moment a key is pressed, i.e, if in 2ms a key is pressed, it will return at that very moment.

cv2.waitKey(0) waits for an input for unlimited time duration, meaning, it will wait until a key is pressed. When a key is pressed, this function is returned and normal execution of the code begins after the function call.

Happy Learning :slightly_smiling_face:

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.