imu and camera parameters

Hello, I used this code to get the transformation matrix, but I was not sure if this “sensors_configuration.camera_imu_transform” gives me the IMU-to-camera transform or the camera-to-IMU transform. Could you please clarify it for me?

And also, what is the coordinate system of the Zed2 IMU and both of the cameras, left and right?


import os
import csv
import time
import argparse
import datetime
from pathlib import Path
from threading import Thread, Lock
import copy
import json
import numpy as np
import cv2
import pyzed.sl as sl
import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), "mocap/mocap_ros"))
from scipy.spatial.transform import Rotation as R


zed = sl.Camera()


init = sl.InitParameters()
init.camera_resolution = sl.RESOLUTION.HD1080
init.camera_fps = 30
init.depth_mode = getattr(sl.DEPTH_MODE, "NEURAL")
init.coordinate_units = sl.UNIT.METER
init.coordinate_system = sl.COORDINATE_SYSTEM.IMAGE
zed.open(init)

info = zed.get_camera_information()
cam_imu_transf = info.sensors_configuration.camera_imu_transform  # IMU to Left Camera transform
save_path = Path("zed_imu_transform.json")
cam_imu_list = cam_imu_transf.m.tolist()  # .m gives the 4x4 matrix

with open(save_path, "w") as f:
    json.dump({
        "Transformation Matrix": {
            "cam_imu_transf": cam_imu_list
        }
    }, f, indent=4)
print(cam_imu_transf)

Hi @Mickyas
Welcome to the Stereolabs community.

You’ve set init.coordinate_system = sl.COORDINATE_SYSTEM.IMAGE, you can find the reference system here:

Thanks very much; that helps me a lot. So is it possible to have the IMU → Right Camera transform also as we did for the IMU → Left Camera transform using a code? I could not find the class that dose that