January 2018
Intermediate to advanced
268 pages
6h 20m
English
As we can see in the preceding code, we use OpenCV's VideoCapture function to create the video capture object cap. Once it's created, we start an infinite loop and keep reading frames from the webcam until we encounter a keyboard interrupt.
In the first line within the while loop, we have the following line:
ret, frame = cap.read()
Here, ret is a Boolean value returned by the read function, and it indicates whether or not the frame was captured successfully. If the frame is captured correctly, it's stored in the variable frame. This loop will keep running until we press the Esc key. So, we keep checking for a keyboard interrupt in the following line:
if c == 27:
As we know, the ASCII value of Esc is 27. Once we encounter ...
Read now
Unlock full access