Ask Your Question
0

Problem reading multiple identical USB webcams

asked 2013-06-24 13:11:57 -0600

juliaashk gravatar image

Hello,

So right now I am trying to write some code so that I can read from 6-8 webcams simultaneously. The eventual goal is to calibrate them and do some other image processing. I should also mention that I am using Visual Studio 2010 on my Windows 7 machine.

Right now I am using cvCreateCameraCapture which works splendidly for 1-2 cameras, and even works for 3 cameras when 2 of them are matching USB cameras and one of them is my built in laptop camera. The problem comes around when I start trying to read from 3 identical cameras.

i.e. here is my code until the line it breaks at: CvCapture* capture0; CvCapture* capture1; CvCapture* capture2;

capture0 = cvCreateCameraCapture(0);
capture1 = cvCreateCameraCapture(1);
capture2 = cvCreateCameraCapture(2);

assert( capture0 != NULL );
assert( capture1 != NULL );
assert( capture2 != NULL );

I was reading on some forum that there might be some issue with overloading the USB ports due to the fact that the webcam images are uncompressed. However, all of these posts referenced solutions using 2003 Windows libraries that are no longer accessible.

So my specific questions are:

  1. Is there a better function to be using than cvCreateCameraCapture?
  2. Is there a way to convert raw streaming uncompressed camera feeds to compressed, and how would one do this (all solutions I saw were for Linux)?

Thanks in advance for any assistance you might be able to provide

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2013-06-24 13:36:44 -0600

HD_Mouse gravatar image

I think your issue of reading from 6 webcams is a hardware issue, actually. From my understanding, USB ports all typically go onto the same bus, and unless your computer has multiple buses for usb, the port will easily get clogged from 6 webcams streaming data. Getting two webcams to work can typically be done, but 3 or more would start getting hangly. You are likely getting 3 to work because I'm guessing that your laptop webcam has its own dedicated bus. A workaround (and also a way to test my theory) is to multiplex your cameras by turning the camera on, grabbing the data, then turning it off, then cycling between the other cameras.

To directly answer your questions.

  1. I'm not familiar with the cvCreateCameraCapture, and searching for it in the documentation doesn't yield any results. The C interface function for video capture is cvCaptureFromCAM. To close the capture, you can use cvReleaseCapture. It's worth mentioning, that unless you're absolutely constrained to the C, you should consider using the C++ interface, as it is cleaner and more user-friendly.

  2. Unfortunately, I don't know of an innate way for OpenCV to and I doubt there is one. I can't help you with this. That said, I think the problem is rooted at what I mentioned above.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-06-24 13:11:57 -0600

Seen: 2,300 times

Last updated: Jun 24 '13