stereolabs / zed-python-api

Python API for the ZED SDK
https://www.stereolabs.com/docs/app-development/python/install/
MIT License
209 stars 95 forks source link

set_from_svo_file() does not work on Windows #138

Closed JesperChristensen89 closed 4 years ago

JesperChristensen89 commented 4 years ago

On Windows 10 with newest SDK (downloaded installed this week). Works on Linux.

Code snippet to reproduce:

import pyzed.sl as sl
import numpy as np
import cv2
from datetime import datetime

if __name__ == "__main__":
    path = "test.svo"

    init_params  = sl.InitParameters()
    init_params.input.set_from_svo_file(path)
    init_params.svo_real_time_mode = False
    init_params.depth_mode = sl.DEPTH_MODE.QUALITY
    init_params.coordinate_units = sl.UNIT.MILLIMETER  # Use milliliter units (for depth measurements)
adujardin commented 4 years ago

The input struct is tricky to use, it's either :

input_t = sl.InputType()
input_t.set_from_svo_file(path)
init_params.input = input_t

or directly like this :

 init_params.set_from_svo_file(path)

Otherwise, the value is discarded in a temporary object. This is caused by Cython and the need to match the C++ API.

However, it's true that there was a problem in the export_svo sample which is now fixed https://github.com/stereolabs/zed-examples/commit/3c035a711f9bce7250f38346c80ddfd9afd140bd