I'm using 2 Logitech C170 usb webcams connected to USB 3.0 ports on my front panel on Windows 10 Opencv 3.1 Visual Studio 2015. I have no problem getting image from one camera at a time either 0 or 1 but while I'm trying to get both at the same time i get a message:
R doesn't work
in console which is linked to second camera not working in the same time, followed by error:
OpenCV Error: Assertion failed (size.width>0 && size.height>0) in cv::imshow
Code I'm using:
#include <opencv2\opencv.hpp>
#include <opencv\highgui.h>
using namespace cv;
using namespace std;
int main()
{
VideoCapture captureL(0);
if (!captureL.isOpened()) cout << "L doesn't work" << endl;
VideoCapture captureR(1);
if (!captureR.isOpened()) cout << "R doesn't work" << endl;
Mat imageL, imageR;
while (1)
{
captureL >> imageL;
captureR >> imageR;
imshow("OriginalL", imageL);
imshow("OriginalR", imageR);
waitKey(1);
}
captureL.release();
captureR.release();
return 0;
}
Is there any way to fix that? It must be possible to get multiple captures at once. Maybe I'm doing something wrong since it is the newest Opencv 3.1.