Use 2 cameras simultaneously

asked 2016-06-24 05:48:18 -0600

Oyavq gravatar image

Hello I try use 2 webcams in opencv 3.10 simultaneously

It seems that framerate drops down from 25 fps to ~ 20 fps on one webcam and from 30 to ~20 fps on the other. If I comment all code relevant to one of the webcams fps comes back to 25 fps or 30 fps depending on webcam.

I tried different methods

VideoCapture >> UMat; //or
VideoCapture.grab(); VideoCapture.retrive();

Also I tried to grab fames in different threads using std::async.

The result is always the same.

The code is simple loop with waitKey(30) and imshow

Platform: Windows 10 x64 Visual Studio 2015 community, 
Build type is win32
edit retag flag offensive close merge delete

Comments

it's probably more a usb bandwidth problem.

a single usb2 controller can barely handle the output of a single webcam, so if you want to use more cams, either reduce the resolution, or try to plug one in the front, the other into the back of your box (so they end up on different controllers)

berak gravatar imageberak ( 2016-06-24 06:07:38 -0600 )edit

take a look at this

sturkmen gravatar imagesturkmen ( 2016-06-24 07:15:09 -0600 )edit

berak, No, it's not about usb bandwidth. When I use iSpy framerate is correct for both.

Oyavq gravatar imageOyavq ( 2016-06-24 07:49:17 -0600 )edit