Many USB Cameras at the same time in one application?

Hello!
I’m building this http://forum.openframeworks.cc/t/stitching-many-cameras-together-for-ofxopencv-blob-analysis/8157/0

My only problem is I cannot get more than two cameras working at the same time. I have three identical Microsoft LifeCam HD-5000 webcams with their firmwares and software up-to-date and they all work fine when I call them one by one. But when I call three, the last one always fails and it is not a hardware problem (I checked).
Any help would be greatly appreciated!

In the testApp.h I have this:

  
ofVideoGrabber 		    vidGrabber_[3];  
ofxCvColorImage			colorImg_[3];  

In the setup() I have this:

  
 for (int devicenumber= 0; devicenumber< 3 ; devicenumber++){  
     vidGrabber_[devicenumber].setDeviceID(devicenumber);  
     vidGrabber_[devicenumber].initGrabber(640,360);  
     colorImg_[devicenumber].allocate(640,360);  
}  
  

In the update() I have this:

  
for (int devicenumber= 0; devicenumber< 3 ; devicenumber++){  
     bool bNewFrame = false;  
     vidGrabber_[devicenumber].grabFrame();  
     bNewFrame = vidGrabber_[devicenumber].isFrameNew();  
     if (bNewFrame){  
          colorImg_[devicenumber].setFromPixels(vidGrabber_[devicenumber].getPixels(),640,360);  
          colorImg_[devicenumber].updateTexture();  
     }  
}  

And the following is the console ouput. As you can see Device 2 (the third) fails at “ERROR: Could not start graph”. It also happens to fail while it is loading and not running either update() or draw().

[tt]
***** VIDEOINPUT LIBRARY - 0.1995 - TFW07 *****

SETUP: Setting up device 0
SETUP: Microsoft LifeCam HD-5000
SETUP: Couldn’t find preview pin using SmartTee
SETUP: Default Format is set to 640 by 480
SETUP: trying format RGB24 @ 640 by 360
SETUP: Capture callback set
SETUP: Device is setup and ready to capture.

***** VIDEOINPUT LIBRARY - 0.1995 - TFW07 *****

SETUP: Setting up device 1
SETUP: Microsoft LifeCam HD-5000
SETUP: Couldn’t find preview pin using SmartTee
SETUP: Default Format is set to 640 by 480
SETUP: trying format RGB24 @ 640 by 360
SETUP: Capture callback set
SETUP: Device is setup and ready to capture.

***** VIDEOINPUT LIBRARY - 0.1995 - TFW07 *****

SETUP: Setting up device 2
SETUP: Microsoft LifeCam HD-5000
SETUP: Couldn’t find preview pin using SmartTee
SETUP: Default Format is set to 640 by 480
SETUP: trying format RGB24 @ 640 by 360
SETUP: Capture callback set
ERROR: Could not start graph

SETUP: Disconnecting device 2
SETUP: freeing Grabber Callback
ERROR - Could not pause pControl
SETUP: freeing Renderer
SETUP: freeing Capture Source
SETUP: freeing Grabber Filter
SETUP: freeing Grabber
SETUP: freeing Control
SETUP: freeing Media Type
SETUP: removing filter Microsoft LifeCam HD-5000…
SETUP: filter removed Microsoft LifeCam HD-5000
SETUP: freeing Capture Graph
SETUP: freeing Main Graph
SETUP: Device 2 disconnected and freed

OF: OF_LOG_ERROR: error allocating a video device
OF: OF_LOG_ERROR: please check your camera with AMCAP or other software
[/tt]

If you have multiple USB hubs, connecting them to separate or at least only 2 on one hub, might help? If you can you open all three in Amcap (http://noeld.com/programs.asp?cat=video) at the same time then you’ll know that the drivers support it, but some camera drivers don’t support 3 cameras.

1 Like

Yes!
It worked perfectly. Thanks Joshua!
=D

So you just moved them onto separate hubs? If that worked, glad to hear it!

[quote=“joshuajnoble, post:4, topic:8179”]
So you just moved them onto separate hubs?[/quote]

Yes, it worked perfectly. I had also read comments on another thread I had made so your solution made sense.
http://forum.openframeworks.cc/t/usb-cable-extensions-and-repeaters/8163/0

I think you may not see this reply. cause it is very old thread. but I want say thank you really!..

I was facing problem using 2 cams on unity but unity says just very simple error.

I cant find any clue to resolve that problem… I was stuck in that about a week…

I never thought about usb hub. Thx Joshua really!!..