Extending capture options
In the code discussed earlier, cv2.VideoCapture(0) defines the use of the default connected webcam using auto detected reader implementation, but there are multiple options concerning how images are read from the webcam.
At the time of writing this book, with version OpenCV 3.3.0 there is no proper way to list the available webcams, so in a case where you have multiple webcams connected at the time of running this code, you have to increase the index value of VideoCapture until it uses the one that is desired.
It is also possible to force specific reader implementation if multiple are available, such as cv2.CAP_FFMPEG and cv2.CAP_IMAGES, or everyone starting with cv2.CAP_*. You could, for example, use QuickTime ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access