title: Capturing multiple webcams (uvcvideo) with OpenCV on Linux
body: <p>I am trying to simultaneously stream the images from 3 Logitech Webcam Pro 900 devices using OpenCV 2.1 on Ubuntu 11.10. The uvcvideo driver gets loaded for these.</p>
  
  <p>Capturing two devices works fine, however with three I run into the out of space error for the third:</p>
  
  <pre><code>libv4l2: error turning on stream: No space left on device
  </code></pre>
  
  <p>I seem to be running into this issue:
  <a href="http://renoirsrants.blogspot.com.au/2011/07/multiple-webcams-on-zoneminder.html">http://renoirsrants.blogspot.com.au/2011/07/multiple-webcams-on-zoneminder.html</a> and I have attempted to do the quirks=128 (or pretty much any other power-of-two value) trick but to no avail. I also tried on another machine with two USB 2.0 hubs and connecting two cameras to one and the third camera to the second, which resulted into the same problem. I am initializing roughly as follows (using N cameras so the result is actually put into an STL vector):</p>
  
  <pre><code>cv::VideoCapture cap0(0); //(0,1,2..)
  </code></pre>
  
  <p>and attempting to capture all the cameras in a loop as </p>
  
  <pre><code>cap0.retrieve(frame0);
  </code></pre>
  
  <p>This works fine for N=2 cameras. When I set N=3 the third window opens but no image appears and the console is spammed full of V4L2 errors. Similarly, when I set N=2, and attempt to open the third camera in say Cheese (simple webcam capture application), this doesn't work either.</p>
  
  <p>Now comes the big but: After trying guvcview by starting three instances of that, I was able to view three cameras at once (with no problems in terms of frame rate or related), so it does not seem to be a hardware issue. I figure there is some property that I should set, but I'm not sure what that is. I have looked into MJPEG (which these cameras seem to support), but haven't succeeded into setting this property, or detect in which mode (yuyv?) they are running if I start them from OpenCV.</p>
  
  <p>Thoughts?</p>