Converting ambient geomagnetic field to absolute orientation in degree

I am trying to use the magnetic field of the camera to get the absolute direction in degree. I have seen that in ZED_Sensor_Viewer you get this direction, but in the documentation there is no function to get it. I wondered if there was some piece of code to do that in the library.

Screenshot from 2022-02-07 16-58-45

I want to use this data:

magnetic_field = zed.get_magnetic_field()
x = magnetic_field[0]
y = magnetic_field[1]
z = magnetic_field[2]

Hi @kimzed
the information that you are searching for is available in the structure SensorsData::MagnetometerData:
C++: SensorsData::MagnetometerData Class Reference | API Reference | Stereolabs
Python: MagnetometerData Class Reference | API Reference | Stereolabs

Be sure to use an updated version of the ZED SDK because the fields have been introduced only recently.

1 Like