Hello,
I’m trying to automatically retrieve the calibration parameters of a ZED camera using .svo files with the next script:
self.input_type = sl.InputType()
self.input_type.set_from_svo_file(self.svo_filepath)
self.init = sl.InitParameters(input_t=self.input_type, svo_real_time_mode=False)
self.init.camera_resolution = sl.RESOLUTION.HD1080
self.init.depth_mode = sl.DEPTH_MODE.NEURAL
self.cam = sl.Camera()
self.status = self.cam.open(self.init)
if self.status != sl.ERROR_CODE.SUCCESS:
print(repr(self.status))
exit()
calibration_params = self.cam.get_camera_information().camera_configuration.calibration_parameters_raw
focal_left_x = calibration_params.left_cam.fx
focal_left_y = calibration_params.left_cam.fy
principal_left_x = calibration_params.left_cam.cx
principal_left_y = calibration_params.left_cam.cy
When executing it wih a .svo file I get the next results:
focal_left_x: 739.197998046875
focal_left_y: 739.073974609375
principal_left_x: 972.2130126953125
principal_left_y: 527.6489868164062
Upon opening the same .svo file with the ZED_Explorer from the SDK I can see the next window:
As you can see the cy parameter is different. Is this normal?
The purpose of doing this is to be able to grab an (x, y) pixel coordenate on a frame, get the current (Xo, Yo, Zo) coordenate in the point cloud data and compare it to the (X1, Y1 , Z1) in the same pixel if the depth was different.
As I understand it this is possible by using the intrinsic camera parameters as follows:
K = np.array([[fx, 0, cx],
[0, fy, cy],
[0, 0, 1]])
# Pixel coordinates and depth example values
x = 340
y = 240
Z = 5.0
# World coordinates (X, Y, Z) calculation
pixel_coords = np.array([x, y, 1])
inv_K = np.linalg.inv(K)
world_coords = Z * np.dot(inv_K, pixel_coords)
Any comments would be apreciated. Thank you in advanced.