Agisoft Metashape

Agisoft Metashape => Python and Java API => Topic started by: mitchgalea on July 29, 2022, 08:17:38 AM

Title: Estimated yaw pitch and roll values from Camera transform in python api
Post by: mitchgalea on July 29, 2022, 08:17:38 AM
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
Title: Re: Estimated yaw pitch and roll values from Camera transform in python api
Post by: Alexey Pasumansky on July 29, 2022, 12:56:59 PM
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