列出python-opencv中的可用设备 [英] Listing available devices in python-opencv
问题描述
我有两个连接到我的笔记本电脑的摄像头(一个内置),两个都可以. (如果我使用的是Cheese,这是Ubuntu附带的一个网络摄像头,它将使用外部的).如果我使用
cap = cv.CreateCameraCapture(0)
或
cap = cv.CreateCameraCapture(-1)
我有内置的网络摄像头.如果我使用
cap = cv.CreateCameraCapture(1)
它不起作用,对象"cap"显示为:
<Capture (nil)>
与CaptureFromCAM相同.所以我想知道openCV打算做什么,以及为什么它似乎不了解第二台摄像机.应该有两个设备(两个都有/dev/videoN条目).
这是OpenCV的普遍问题,如下所示.似乎只有内置或第一个USB cam(仅当您没有内置cam时)才能在OpenCV中工作:
当前,无法提取此功能请求中列出的摄像机数量:
https://code.ros.org/trac/opencv/ticket/935
I have two webcams attached to my laptop (one built in), both of which work. (If I use Cheese, a webcam thingy that comes with Ubuntu, it uses the 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)
It doesn't work and the object `cap' displays as:
<Capture (nil)>
Same with CaptureFromCAM. So I'd like to know what openCV is trying to do and why it doesn't seem to know about the second camera. There should be two devices available (there are /dev/videoN entries for both).
This is a general problem of the OpenCV, as you can see below. It seems that only the builtin, or the first USB cam (only if you do not have a buildin cam) works in OpenCV:
How to use a camera with OpenCV
Cannot access usb webcam through OpenCV, Cygwin
OpenCV capture from USB not iSight (OSX)
Currently, there is no way to extract the number of cameras, as listed in this feature request:
https://code.ros.org/trac/opencv/ticket/935
这篇关于列出python-opencv中的可用设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!