Ask Your Question

BGYOO's profile - activity

2017-11-07 18:52:23 -0600 received badge  Enthusiast
2017-10-30 21:00:10 -0600 received badge  Organizer (source)
2017-10-30 20:59:07 -0600 asked a question opencv_contrib CMake build error in Windows10

opencv_contrib CMake build error in Windows10 Hi I have some errors while build the opencv. First, I included Qt, VTK, E

2016-08-17 00:55:52 -0600 asked a question How many can connect to Web Cameras?

I try to connect the six-cameras in opencv. However, only four cameras are connected. How is it able to connect all six cameras?

int main()
{

VideoCapture* cap = new VideoCapture[6];
cap[0].open(0);
if (!cap[0].isOpened())
{
    printf("Error video 0\n");
}
cap[1].open(1);
if (!cap[1].isOpened())
{
    printf("Error video 1\n");
}
cap[2].open(2);
if (!cap[2].isOpened())
{
    printf("Error video 2\n");
}
cap[3].open(3);
if (!cap[3].isOpened())
{
    printf("Error video 3\n");
}
cap[4].open(4);
if (!cap[4].isOpened())
{
    printf("Error video 4\n");
}
cap[5].open(5 );
if (!cap[5].isOpened())
{
    printf("Error video 5\n");
}

Mat *frame = new Mat[6];
cap[0] >> frame[0];
cap[1] >> frame[1];
cap[2] >> frame[2];
cap[3] >> frame[3];
cap[4] >> frame[4];
cap[5] >> frame[5];
while (1)
{
    if (waitKey(10) == 27)
        break;
    if (frame[0].empty() || frame[1].empty() || frame[2].empty() || frame[4].empty() || frame[4].empty() || frame[5].empty())
        break;
    cap[0] >> frame[0];
    cap[1] >> frame[1];
    cap[2] >> frame[2];
    cap[3] >> frame[3];
    cap[4] >> frame[4];
    cap[5] >> frame[5];

    imshow("img1", frame[0]);
    imshow("img2", frame[1]);
    imshow("img3", frame[2]);
    imshow("img4", frame[3]);
    imshow("img5", frame[4]);
    imshow("img6", frame[5]);
}

return 0;

}