Forum

Author Topic: Problem with rotation angles  (Read 2099 times)

guicanarin

  • Newbie
  • *
  • Posts: 32
    • View Profile
Problem with rotation angles
« on: August 16, 2019, 05:39:09 PM »
Hello guys, i used a code to translate and transform my coordinate system to the first camera of my chunk, and the code was..
Code: [Select]
import Metashape

def CS_to_camera():

print("Script started...")
chunk = Metashape.app.document.chunk
if not chunk:
print("Empty project, script aborted")
return
selected = [camera for camera in chunk.cameras if camera.selected and camera.transform]
if len(selected) != 1:
print("Select only one aligned camera to procees. Script aborted.")
return
camera = selected[0]

Rt = camera.transform


chunk.transform.translation = Metashape.Vector((0,0,0))

chunk.transform.matrix = chunk.transform.matrix * Rt.inv()

print("System set to " + camera.label + " coordinates. Script finished.")
return 1
CS_to_camera()
Metashape.app.addMenuItem("Custom menu/Coordinate system to camera", CS_to_camera)
With this code, when i export the cameras its positions and rotations should be value "0" for X, Y, Z and Ome, Phi and Kappa.
But i had X =0, Y = 0, Z = 0, Omega = - 180, Phi = 0 and Kappa = 0.
I don't have any idea what is causing this Omega value.
Someone has any idea how to turn this value to "0"??

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14846
    • View Profile
Re: Problem with rotation angles
« Reply #1 on: August 16, 2019, 06:25:21 PM »
Hello guicanarin,

Have you tried the approach from this post:
https://www.agisoft.com/forum/index.php?topic=11120.msg50047#msg50047
Best regards,
Alexey Pasumansky,
Agisoft LLC

guicanarin

  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: Problem with rotation angles
« Reply #2 on: August 16, 2019, 09:15:07 PM »
I got it!!
It Works!!
Thanks, Alexey!