stereolabs / zed-opencv

ZED SDK interface sample for OpenCV
https://www.stereolabs.com/docs/opencv/
MIT License
137 stars 79 forks source link

revision for running zed-opencv with svo file #56

Closed gcutt closed 6 years ago

gcutt commented 6 years ago

The readme says that "you can optionally provide an SVO file path" and run zed-opencv on a .svo file, but this does not seem to work. I have built the code, and it runs with the camera plugged in, but it returns an error when I try to run it by supplying a .svo file arg.
E.g.

ZED_with_OpenCV.exe my.svo CAMERA NOT DETECTED

The error occurs at zed.open // Open the camera ERROR_CODE err = zed.open(init_params); if (err != SUCCESS) { printf("%s\n", toString(err).c_str()); zed.close(); return 1; // Quit if an error occurred }

I fixed this by adding the following code to main, prior to the zed.open operation:

// For replaying SVO file
if (argc == 2) {
    printf("attempting to open %s: \n", argv[1]);
    init_params.svo_input_filename.set(argv[1]);
}

Now it works.

WASCHMASCHINE commented 6 years ago

Just btw: If you have the fix, you could just create a pull request.

adujardin commented 6 years ago

Thanks for pointing that out, I'll push a fix.