Ask Your Question
0

AVT mako GIGE cameras into openCv

asked 2016-02-04 13:11:41 -0600

stillNovice gravatar image

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.

edit retag flag offensive close merge delete

Comments

dropping the packet size helps, but it is still laggy. I take this to mean that my ethernet setup is not up to the task.

stillNovice gravatar imagestillNovice ( 2016-02-04 14:58:27 -0600 )edit
1

Did you enable jumbo packaging on your network interface? IF not then it will limit the amount of data that can get buffered at once. If you tell me your OS I can guide you to the correct location for setting this!

StevenPuttemans gravatar imageStevenPuttemans ( 2016-02-05 06:31:59 -0600 )edit

Also keep in mind that for a moving stereo rig, you will have to trigger your cameras using trigger cables to ensure that both images are taken at exactly the same time. If you simply use videocapture than the capture will be sequential and will thus only work good for stereo reconstruction in a fixed non moving object setup.

StevenPuttemans gravatar imageStevenPuttemans ( 2016-02-05 06:33:08 -0600 )edit

jumbo packaging? i did not! I am on windows 7 64. Thanks a lot!

stillNovice gravatar imagestillNovice ( 2016-02-05 10:32:39 -0600 )edit

also, re: triggering... Can I slave one camera to the other? Or do i need an external trigger device of some kind?

stillNovice gravatar imagestillNovice ( 2016-02-05 10:33:22 -0600 )edit

Hi Steven, I have opened a new question about triggering, if you have time, I would very much appreciate your feedback. Thanks! http://answers.opencv.org/question/86...

stillNovice gravatar imagestillNovice ( 2016-02-06 03:26:47 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2016-02-07 14:42:27 -0600

stillNovice gravatar image

The answer was a combination of factors.. First, enabling jumbo frames on my Giga card, as per Steven Puttemans advice. (Thanks!)

Secondly, I added a mutex lock to ensure I was calling an entire frame, as described here:

http://answers.opencv.org/question/74...

edit flag offensive delete link more

Comments

Sorry for the delay, but glad you fixed it!

StevenPuttemans gravatar imageStevenPuttemans ( 2016-02-08 03:09:40 -0600 )edit

About the slaving, I am not sure AVT camera's support that. We use an external trigger print, custom build for our setup.

StevenPuttemans gravatar imageStevenPuttemans ( 2016-02-08 03:10:15 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-02-04 13:11:41 -0600

Seen: 1,276 times

Last updated: Feb 07 '16