Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

AVT mako GIGE cameras into openCv

Hi all, I am attempting to stream a stereo camera rig, made up of 2 x AVT Gige cameras, through into openCv::Mat format, for processing. Using the PvApi, I am able to connect to one at a time using a standard VideoCapture.

int main()
{
    VideoCapture cameraLeft(1 + CV_CAP_PVAPI);
    //VideoCapture cameraRight(0 + CV_CAP_PVAPI);

    Mat frameLeft;
    Mat frameRight;

    while (true) {
        cameraLeft >> frameLeft;
        imshow("frameLeft", frameLeft);

        //cameraRight >> frameRight;
        //imshow("frameRight", frameRight);

        int key = waitKey(10);
        if (key == 27) {
            break;
        }
    }

    return 0;
}

With those sections commented out, it runs fine. BUT as soon as I uncomment:

VideoCapture cameraRight(0 + CV_CAP_PVAPI);

I only see partial images, as if the data is getting corrupted. How can i stream two cameras at the same time here?

Thanks.