Dan Farmer | 1 Mar 19:38 2011
Picon

Multiple Cameras with OpenCV 2.2 (Python)

Hello,

I've been trying to get multiple cameras working with Python using the
following test script in Fedora Linux 14 (32bit). There are three
cameras attached via USB (though I'm just trying to get two going for
now). Any help would be appreciated.

#! /usr/bin/env python
import cv

cap1 = cv.CaptureFromCAM(1)
#cap2 =  None
cap2 = cv.CaptureFromCAM(0)

while True:
    img1 = cv.QueryFrame(cap1)
    cv.ShowImage("Camera 1", img1)
    if cap2:
        img2 = cv.QueryFrame(cap2)
        cv.ShowImage("Camera 2", img2)
    if cv.waitKey(60) > 0:
        break

However the results I get are one camera working, the "Camera 2"
window is blank and in the console I get

VIDIOC_QBUF: Invalid argument
VIDIOC_QBUF: Invalid argument
VIDIOC_QBUF: Invalid argument
VIDIOC_QBUF: Invalid argument
VIDIOC_QBUF: Invalid argument

Thanks!

-Dan

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 

Gmane