sl.InitParameters.set_from_svo_file() bug

I am getting a bug when attempting to generate a sl.InitParameters object from an .svo file.

Method:

        elif isinstance(source,str):
        
            file_path = source
            assert ".svo" in os.path.splitext(file_path)[1],f"Provided file_path {file_path} is not .svo file"


            self.init_params.set_from_svo_file(file_path)
            logging.info(f"Building Camera From SVO {file_path}")

Debugger:

>>>self.init_params

<pyzed.sl.InitParameters object at 0xffff0dc6d3d0>
async_grab_camera_recovery:False
camera_disable_self_calib:False
camera_fps:0
camera_image_flip:OFF
camera_resolution:<RESOLUTION.AUTO: 7>
coordinate_system:IMAGE
coordinate_units:<UNIT.MILLIMETER: 0>
depth_maximum_distance:-1.0
depth_minimum_distance:-1.0
depth_mode:<DEPTH_MODE.PERFORMANCE: 1>
depth_stabilization:1
enable_image_enhancement:True
enable_image_validity_check:False
enable_right_side_measure:False
grab_compute_capping_fps:0.0
input:
'Traceback (most recent call last):\n  File "/home/user/.vscode/extensions/ms-python.python-2024.4.1/python_files/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_resolver.py", line 189, in _get_py_dictionary\n    attr = getattr(var, name)\nAttributeError: unreadable attribute\n'
open_timeout_sec:5.0
optional_opencv_calibration_file:''
optional_settings_path:''
sdk_gpu_id:-1
sdk_verbose:1
sdk_verbose_log_file:"
sensors_required:False
svo_real_time_mode:False

Not sure how to address this. The update tutorial uses the sl.InputType object to initialize the InitParameters:

but InitParameters still has the method InitParameters.set_from_svo_file , which presumably would produce the same results.

Edit: I tried to instantiate InitParameters using the approach outline in the tutorial:

inpt = sl.InputType()
inpt.set_from_svo_file(file_path)
init = sl.InitParameters(input_t=inpt,svo_real_time_mode=False)
>> init
<pyzed.sl.InitParameters object at 0xffff08c5cdb0>

async_grab_camera_recovery:False
camera_disable_self_calib:False
camera_fps:0
camera_image_flip:OFF
camera_resolution:<RESOLUTION.AUTO: 7>
coordinate_system:IMAGE
coordinate_units:<UNIT.MILLIMETER: 0>
depth_maximum_distance:-1.0
depth_minimum_distance:-1.0
depth_mode:<DEPTH_MODE.PERFORMANCE: 1>
depth_stabilization:1
enable_image_enhancement:True
enable_image_validity_check:False
enable_right_side_measure:False
grab_compute_capping_fps:0.0
input:
'Traceback (most recent call last):\n  File "/home/user/.vscode/extensions/ms-python.python-2024.4.1/python_files/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_resolver.py", line 189, in _get_py_dictionary\n    attr = getattr(var, name)\nAttributeError: unreadable attribute\n'
open_timeout_sec:5.0
optional_opencv_calibration_file:''
optional_settings_path:''
sdk_gpu_id:-1
sdk_verbose:1
sdk_verbose_log_file:"
sensors_required:False
svo_real_time_mode:False

Hi @frigusgulo,

Is the camera able to open when using this InitParameters object you’ve created?

Yes, the camera is successfully built and is able to produce images.

@mattrouss I have more information.

When building a camera from .SVO, the camera’s current time reference is not synced with the image timestamp:

Capture Method

        self.zed.retrieve_image(self.left_image, sl.VIEW.LEFT)
        self.zed.retrieve_image(self.right_image, sl.VIEW.RIGHT)
        self.zed.retrieve_measure(self.depth_map_meas, sl.MEASURE.DEPTH)
        self.zed.get_position(self.pose,sl.REFERENCE_FRAME.WORLD)
        out = Image(**{
            "rgb" : self.left_image.get_data(),
            "depth" : self.depth_map_meas.get_data(),
            "model" : self.camera_model,
            "uuid" : self.uuid.serial_number,
            "timestamp" : self.left_image.timestamp.get_seconds(),
            "pose":self.pose
        })
        
        
      
        return out

Debugger:

out.timestamp
1710961301
self.zed.get_timestamp(sl.TIME_REFERENCE.CURRENT)
<pyzed.sl.Timestamp object at 0xffff06e56250>
self.zed.get_timestamp(sl.TIME_REFERENCE.CURRENT).get_seconds()
1713545076
self.zed.get_timestamp(sl.TIME_REFERENCE.IMAGE).get_seconds()
1710961301
self.zed.get_timestamp(sl.TIME_REFERENCE.CURRENT).get_seconds() - self.left_image.timestamp.get_seconds()
2584087

Just to show respective times between current,image,and gps times:

Logs:

INFO:root:Building Camera From SVO /home/user/xxxxxx/camera_recording_0.svo
INFO:root:Camera 47733007 initialized| timestamp=0 time_delta=0 serial_number=47733007 uuid=<pyzed.sl.CameraIdentifier object at 0xffff336b1970> device_model='ZED_X' translation=[0, 0, 0] orientation=[0, 0, 0] intrinsic_model={'f_row': 725.7243041992188, 'f_col': 725.7243041992188, 'c_row': 613.1058349609375, 'c_col': 996.720703125} id=None input='SVO' state=None position=0 fov_h=105.8272705078125 depth_distance=30
INFO:root:Camera 47733007:  Configuration Successful
INFO:root:Camera 47733007: Started publishing SUCCESS
INFO:timbertrack.core.fusion:Fusion: Positional tracking enabled
INFO:root:Camera 47733007: Started publishing SUCCESS
INFO:timbertrack.core.fusion:Fusion Subscribed to camera: 47733007
INFO:timbertrack.core.svo_gpx_processing:Image Timestamp: 1710961301
INFO:timbertrack.core.svo_gpx_processing:Camera Timestamp Current: 1713546787 [s]
INFO:timbertrack.core.svo_gpx_processing:Camera Timestamp Image: 1710961301 [s]
INFO:timbertrack.core.svo_gpx_processing:GPS Measurement: timestamp=1710961301504 [ms] time_delta=0 lat=44.6600692 lon=-123.4037362 elevation=313.364 covariance=[10.955976623603437, 0.1060150677777918, 0.6669942633065005, 0.41215271640111173, 10.90956277886006, 0.15151398181113096, 0.37131466358183973, 0.9900633117612657, 33.45777062189895]
INFO:timbertrack.core.fusion:GNSS Data: Latitude: 44.xxxxx, Longitude: -123.xxxxxx, Elevation: 313.364, Timestamp: 1710961301504 [ms], Covariance: [10.955976623603437, 0.1060150677777918, 0.6669942633065005, 0.41215271640111173, 10.90956277886006, 0.15151398181113096, 0.37131466358183973, 0.9900633117612657, 33.45777062189895]
INFO:timbertrack.core.svo_gpx_processing:GPS Ingest Status: INVALID_TIMESTAMP

Terminal:

2024-04-19 17:13:42 UTC][ZED][WARNING] The timestamp of the GNSS data you are attempting to ingest for [GeoTracking]  is different from the camera timestamp. Timestamp difference: 1564317696 ms.

@mattrouss @alassagne @Myzhar Any ideas?

Hi @frigusgulo,

If the SVO file is read correctly with initParameters, then the behavior is correct.

The issue here seems to be different, and relative to how you are printing the values of the InitParameters attributes. Since the input attribute is of type sl.InputType, it must be displayed differently in your script.

The timestamp issue you are observing is unrelated to this, I will answer to this in the other issue you have opened.