def read_metadata(path):
input_type = sl.InputType()
if isinstance(path, str):
input_type.set_from_svo_file(path)
else:
input_type.set_from_svo_file(str(path))
print('reading file:', path)
init = sl.InitParameters(input_t=input_type, svo_real_time_mode=False)
cam = sl.Camera()
status = cam.open(init)
if status != sl.ERROR_CODE.SUCCESS:
print(repr(status))
return tuple([None]*7)
_cam_info = cam.get_camera_information()
fps = _cam_info.camera_fps
n_frame = cam.get_svo_number_of_frames()
width, height = _cam_info.camera_resolution.width, _cam_info.camera_resolution.height
if cam.grab() == sl.ERROR_CODE.SUCCESS :
start_time = convert_zed_ts(cam.get_timestamp(sl.TIME_REFERENCE.IMAGE))
else:
cam.close()
return tuple([None]*7)
cam.set_svo_position(n_frame)
if cam.grab() == sl.ERROR_CODE.SUCCESS :
print(f"end frame: {cam.get_svo_position()} {n_frame-1}")
end_time = convert_zed_ts(cam.get_timestamp(sl.TIME_REFERENCE.IMAGE))
else:
cam.close()
return tuple([None]*7)
n_dropped_frame = cam.get_frame_dropped_count()
return fps, n_frame, n_dropped_frame, start_time, end_time, width, height
This line, print(f"end frame: {cam.get_svo_position()} {n_frame-1}")
is printing end frame: 1 2425
It should print end frame: 2425 2425
.
The timestamp obtains with the code also agree that the current frame is incorrect.