Hello Josip,
Please send the project file with the camera alignment only (no depth maps, dense cloud or mesh needed) to support@agisoft.com, so that we could adjust the animation creation script accordingly.
In the following script the orientation tag should be considered, but it is better to check on the actual project.
To see the difference you need to select all cameras in the Photos pane and use Rotate Right (clockwise) button, then run the script to create a new animation track.
import Metashape
import math
chunk = Metashape.app.document.chunk
if chunk.camera_track:
chunk.camera_track = None
animation = chunk.addCameraTrack()
chunk.camera_track = animation
animation.label = "Fly Through"
frames = []
for camera in [camera for camera in chunk.cameras if camera.transform and camera.type == Metashape.Camera.Type.Regular]:
frame = chunk.addCamera()
frame.type = Metashape.Camera.Type.Keyframe
orientation = camera.orientation #1 = 0deg, 6 = 90deg, 8 = 270deg, 3 = 180deg
deg = 0
if orientation == 1:
deg = 0
elif orientation == 6:
deg = -math.pi/2.
elif orientation == 8:
deg = math.pi
elif orientation == 3:
deg = +math.pi/2.
E = math.cos(deg)
F = math.sin(deg)
rotation = Metashape.Matrix([[E, -F, 0, 0], [F, E, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]])
camera_transform = camera.transform * rotation
frame.transform = camera_transform
#print(frame)
frames.append(frame)
animation.keyframes = frames
print("Finished")