I am a still beginner in programming, pordon me if this question is too trivial. Let say I have this code:
camera = cv2.VideoCapture('path_to_video_file')
while True:
#reading frames of video
ret, frame = camera.read()
cv2.imshow("Video", frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
So, from my understanding, at the instance when the frame is shown (in the "Video" window), if at the same time, the q
key is pressed, the loop would break. But I don't really understand how the if cv2.waitKey(1) & 0xFF == ord('q')
line works.
I do know this is an AND
bitwise operation in which output is 1 only if both of the two inputs is also 1. But that is all abut it. So, I really want to know what is exactly happening.
And also, what is actually the 0xFF == ord('q')
means?