Hi,

I have a ZED 2i camera from which i obtain my point clouds and images. However, sometimes, the camera inclinates for some external reasons.

I need the point clouds to be straightened in order to calculate slopes (purpose of the camera). I am struggling understanding the operations needed. In the doc, i can get the euler angles in format YZX, then i apply this rotation with this angles (but inversed) with numpy operations BUT the point cloud is not straightened up.

Then i realized i could use the pyzed to obtain the rotation matrix. But i just realized that if i inverse this matrix (transform.inverse) and I apply it to the point cloud it distorts, but if i dont reverse, the point cloud seems straightened. How is this possible? Should this rotation matrix be inverted?

Thanks in advance.

Hi Cristian,

By default, the ZED SDK uses the IMU information to orient the camera with respect to the gravity vector. This behavior is controlled with the PositionalTrackingParameters.set_gravity_as_origin parameter. Can you try setting it to `false`

and see if this fixes your orientation issue?

Hi mattrouss, thanks for the response.

I have tried it and it keeps happening. I think this is a problem of identifying the correct angles of rotation and its axis.

I have realized that, WITH THE CAMERA IN THE SAME POSITION, using ZED_Sensors_Viewer Orientation i obtain angles of:

X: - 1.5

Y: + 1.7

Z: + 40

However, with a recorded SVO file, the output of get_euler_angles() is as follows:

( -1.5, -1.7, -40)

NOTE THE SIGNES, They are ALL INVERTED BUT ONE. And my guess is that The func returns the angles XYZ, NOT YZS As the doc says. And why are them inverted except one? The x axis?

Hi @CristianViSa,

Please take a look at this documentation page: Coordinate Frames - Stereolabs

which explains the different coordinate frames of the ZED SDK. The sign difference is probably because ZED Sensor Viewer displays in a different coordinate frame than your sample. Please select the coordinate frame you are expecting.

I am using as default, Right Handed Y down.

So i am totally confused right now. What are the angles to straighten my cloud points using this coordinate frame?

The ones i obtain but inverted? So euler angles returns XYZ or YZX?

The default coordinate frame in the SDK is COORDINATE_SYSTEM_IMAGE, which corresponds to a right-handed-y-down coordinate frame. As ZED_Sensor_Viewer displays the coordinates in IMAGE, this corresponds with the difference in signs that you are experiencing.

I apologize the documentation is a bit confusing about the conventions.

Euler angles created from the sl::Pose values as a sl::float3 representing the rotations around the X, Y and Z axes using YZX convention.

By calling getEulerAngles(), you retrieve the values in a float3 in the order float3(X, Y, Z), in the COORDINATE_SYSTEM defined in the InitParameters.

The “YZX convention” is the convention that describes the order in which the rotations are applied, i.e. we first rotate around the Y axis, then Z, then X.

I hope this helps your understanding of the method.