Ask Your Question

4 Cameras Simultaneously

asked 2013-08-19 06:56:16 -0500

Steve gravatar image

updated 2013-08-21 02:26:03 -0500

Hi, Based on this tutorial,

Is it possible to run this code by using 4 cameras simultaneously and save all 4 results separately? How?

(It would be great if somebody knows the solution in Java ,if not, C++ version also will be helpful)

Thank you in advance.

edit retag flag offensive close merge delete


Just a remark. In the future, try using tags without hashtags to it. It creates unneccesary doubles in the tags list, which makes it harder to perform good filtering on this forum. Thanks in advance! I have adapted your tags for this topic.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-08-21 02:36:24 -0500 )edit

@StevenPuttemans I understand, you are right. sorry.

Steve gravatar imageSteve ( 2013-08-21 17:25:55 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2013-08-19 10:17:46 -0500

berak gravatar image

well, from the opencv side, it's no problem running multiple cams, it's just like:

VideoCapture cap0(0);
VideoCapture cap1(1);

// later:;;

but reality sucks here, again. the usb bandwidth of a single hub is just enough for 1 cam, if you plug 2 or more into 1 bus, you'll saturate it. you can still reduce the framesize,


and pray, that you got 2 seperate hubs ( try front/back )

good luck!

edit flag offensive delete link more



This is one of the main reasons why research uses ethernet or firewire camera's, since it supports a larger bandwidth and the problem of multiple camera's can be easily addressed this way. Actually in your example there won't be an actual problem in retrieving frames, since your are doing it sequentually. It will however create the problems mentioned if you address both captures at the same time in different threads. Result in sequential case will be that your maximum frame capture rate, will be reduced by half or less, since you switch between both captures and you still have overhead problems.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-08-21 02:37:29 -0500 )edit

@berak Thank you. I could run the code with 2 cameras (no resize or manipulation) and there is no problem. Unfortunately I don't have 4 cameras at the time to test with them.

Steve gravatar imageSteve ( 2013-08-21 17:19:59 -0500 )edit

Question Tools


Asked: 2013-08-19 06:56:16 -0500

Seen: 4,963 times

Last updated: Aug 21 '13