List of available devices in python-opencv

I have two webcams attached to my laptop (one built-in), both of which work. (If I use cheese, the webcam that comes with Ubuntu, it uses an external one). If i use

cap = cv.CreateCameraCapture(0) 

or

 cap = cv.CreateCameraCapture(-1) 

I get my built-in webcam. If i use

 cap = cv.CreateCameraCapture(1) 

This does not work, and the `cap 'object is displayed as:

 <Capture (nil)> 

Same thing with CaptureFromCAM. So I would like to know what openCV does and why it does not know about the second camera. Two devices must be available (there are / dev / videoN entries for both).

+4
source share
1 answer

This is a common OpenCV problem, as you can see below. It seems that only the built-in or first USB cam works in OpenCV (only if you don't have a built-in cam):

How to use the camera with OpenCV

Unable to access webcam via OpenCV, Cygwin

Capture OpenCV with USB not iSight (OSX)

There is currently no way to retrieve the number of cameras as indicated in this function request:

https://code.ros.org/trac/opencv/ticket/935

+6
source

Source: https://habr.com/ru/post/1380100/


All Articles