一个USB 2.0集线器上的两个网络摄像头-在Windows中工作,但在Linux中不工作 [英] Two webcams on one usb 2.0 hub - works in windows but not linux
问题描述
下面的openCV代码可同时从两台摄像机获取图像.它在Windows中运行良好,并且摄像机都连接到一个USB 2.0集线器.当我在linux中尝试相同的代码时,一次仅具有一台摄像机的足够带宽.我也尝试过使用guvcview一次查看两个流,这是同一问题.我需要的是通过设置驱动程序请求的带宽量来强制网络摄像头协同工作的方法.
The openCV code below grabs simultaneous images from two cameras. It works fine in windows, with the cameras both attached to one usb 2.0 hub. When I try the same code in linux, it only has enough bandwidth for one camera at a time. I've also tried viewing the two streams at once with guvcview, same issue. What I need is some way to force the webcams to work together, possibly by setting the amount of bandwidth the driver requests.
capture = cv.CaptureFromCAM(0)
capture2 = cv.CaptureFromCAM(1)
while True:
frame = cv.QueryFrame(capture)
frame2 = cv.QueryFrame(capture2)
cv.ShowImage("w1", frame)
cv.ShowImage("w2", frame2)
if cv.WaitKey(10) != -1:
break
推荐答案
我也遇到了网络摄像头(LifeCam Cinema)的USB带宽问题,并使用FIX_BANDWIDTH answer .
I had a USB bandwidth issue with webcams (LifeCam Cinema) as well and solved it by using the FIX_BANDWIDTH quirk of the uvcvideo driver. See this answer for details on using the quirk.
我没有尝试过,对于某些我尝试使用的USB主机控制器,两个LifeCams(每个控制器)都可以工作;对于其他人,只有一个.这是我的一台机器视觉机器中的控制器:
Without quirk, for some USB host controllers I tried, two LifeCams worked (per controller); for others, only one. Here the controllers in one of my machine vision machines:
uli@KL04:~$ lspci | grep USB
00:1a.0 USB controller: Intel Corporation C600/X79 series chipset USB2 Enhanced Host Controller #2 (rev 06)
00:1d.0 USB controller: Intel Corporation C600/X79 series chipset USB2 Enhanced Host Controller #1 (rev 06)
03:00.0 USB controller: VIA Technologies, Inc. Device 3483 (rev 01)
0a:00.0 USB controller: ASMedia Technology Inc. Device 1142
0b:00.0 USB controller: ASMedia Technology Inc. Device 1142
(Intel和ASMedia控制器在主板上,VIA在PCIe卡上.)毫无疑问,每个ASMedia控制器仅支持一个LifeCam.
(The Intel and ASMedia controllers are on the motherboard, the VIA is on a PCIe card.) Without quirk, each ASMedia controller supported only one LifeCam.
这篇关于一个USB 2.0集线器上的两个网络摄像头-在Windows中工作,但在Linux中不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!