i have two web cams ( Laptop's cam and an USB webcam )
i tried to capture from two cams at the same time with the code below.
it is working but one of the cams is lagging.
when i make two exe file ( one exe capturing from cam 0
other from cam 1
) and run two exe at the same time, both cam streaming without lagging.
any advice to this problem ?
#include <iostream>
#include <opencv2/opencv.hpp>
using namespace cv;
using namespace std;
int main(int argc, const char * argv[])
{
VideoCapture cap0(0);
VideoCapture cap1(1);
Mat frame0, frame1;
while (cap0.read(frame0))
{
cap1 >> frame1;
if (!frame0.empty())
{
imshow("cap0", frame0);
}
if (!frame1.empty())
{
imshow("cap1", frame1);
}
int key = waitKey(10);
if (key == 27)
break;
}
}
one