Changing the origin to the center of the camera

I’ve been working with the ZED SDK in Python, and I wanted to record poses with the origin at the center of the stereo rig instead of the default left camera. I am using ZED SDK 4.0.8 on my jetson nano.

I’ve tried to modify the matrix and used this link as well to make it work but no progress whatsoever. Link: Coordinate Frames - Stereolabs . Below is a code snippet:

I keep getting a TypeError: ‘int’ object is not subscriptable. Please advise.

Hello @velocityvector,

I assume your error TypeError: ‘int’ object is not subscriptable. happens on the line

transform_[0][3] = tx

It is because for now (with the most recent pyzed version as well as for the 4.0.8 version you are using), no operator[] is implemented in the sl.Transform class. If you feel like it could be a good addition, feel free to add it in zed-python-api/src/pyzed/sl.pyx at master · stereolabs/zed-python-api · GitHub and to open a PR so that we add it in a following patch

Otherwise, to modify the sl.Transform, you can use one of the following methods:

  • transform_.set_rotation_matrix(py_rotation: sl.Rotation)
  • transform_.set_translation(py_translation: sl.Translation)
  • transform_.set_orientation(py_orientation: sl.Orientation)
  • transform_.set_rotation_vector(input0: float, input1: float, input2: float)
  • transform_.set_euler_angles(input0: float, input1: float, input2: float, radian: bool = True)

Yep I fixed it up but I’m still not able to set the origin, is there any code sample or similar forums on how to change the origin?

Hello @velocityvector ,

Is it possible to get your full code ? You could use our positional tracking sample as inspiration.