Forum

Author Topic: Estimated yaw pitch and roll values from Camera transform in python api  (Read 191 times)

mitchgalea

  • Newbie
  • *
  • Posts: 4
    • View Profile
I am trying to access camera yaw pitch and roll estimated values (as appear in GUI reference pane)

To get the transformed camera position I am using the following code:
Code: [Select]
chunk = Metashape.app.document.chunk
camera = chunk.cameras[2]
transform = chunk.transform.matrix * camera.transform
# this works as expected, values are matching those in reference pane
pos = transform.translation()

rot = transform.rotation()
# this is not working, expected values are 93.583, -0.937, -44.785, outputted values are 273.58297001960716, 1.784351814162492, -135.21509554607456
ypr = Metashape.Utils.mat2ypr(rot)
 

I can do this using external libraries, but thought there would be a way to do this inside of metashape. This issue is persistent over different documents

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 13910
    • View Profile
Hello Mitchell,

Please check, how the estimated coordinates and orientation angles are calculated in the following script example:
https://github.com/agisoft-llc/metashape-scripts/blob/master/src/save_estimated_reference.py
Best regards,
Alexey Pasumansky,
Agisoft LLC