I'm using two GigE (basler aca2500-14gm) cameras on win10 opencv3.4, I connect the wires of the 2 cameras to the switch, and then connect it to my computer.but I can't open the camera and get the frames at the same time。 my code: `
int main()
{
PylonInitialize();
VideoCapture cap(0);
VideoCapture cap1(2);
if (!cap.isOpened())
{
cout << "Camera 1 unsuccessfully opened" << endl;
}
if (!cap1.isOpened())
{
cout << "Camera 2 unsuccessfully opened" << endl;
}
bool stop = false;
while (!stop)
{
Mat frame;
Mat frame1;
cap >> frame;
cap1 >> frame1;
if (frame.empty() || frame1.empty())
{
break;
}
imshow("Open the camera 1", frame);
imshow("Open the camera 2", frame1);
if (waitKey(100) >= 0)
{
PylonTerminate();//
stop = true;
}
}
}`
by the way,when I tried to run the sample of basler SDK :Grab_MultipleCameras.cpp, I can open the camera but the image in the window is grey.
is there anyone help me to solve this problem? Thanks in advance.