Agisoft Metashape

Agisoft Metashape => Python and Java API => Topic started by: chehroma on November 29, 2018, 11:35:41 AM

Title: ANIMATION
Post by: chehroma on November 29, 2018, 11:35:41 AM
Can somebody give sample script how to great animation and take avi file???? VERY important.
Title: Re: ANIMATION
Post by: Alexey Pasumansky on December 05, 2018, 08:21:17 PM
Hello chehroma,

Currently it is not possible to create or edit the camera track from Python scripts.

If you require to create the custom script, I suggest to use external modeling application and import the camera track from FBX format. Also the track can be created in Blender and saved in .path format, also support for camera track import. To allow .path format export in Blender it is necessary to install an add-on from the attached script:
 in Blender open File Menu -> User Preferences -> Addons -> User -> Install from file -> use osg_camera_export2.py script (attached), make it active by turning on the check box. Then use File Menu -> Export -> OSG Camera Animation (.path) option to save your track.

Title: Re: ANIMATION
Post by: chehroma on December 06, 2018, 07:14:46 PM
Thank for reply
Title: Re: ANIMATION
Post by: Alexey Pasumansky on December 07, 2018, 01:13:19 PM
Currently the .path file contains the following columns:
T, X, Y, Z, Qx, Qy, Qz, Qw

where T - is the time of the camera position (usually the values in this column go from 0 to the T_total - total duration of the track, with the regular step, i.e. frame rate),
X, Y, Z - coordinates of the camera location, Qx, Qy, Qz, Qw - quaternion that defines the orientation of the camera.

In case the project is georeferenced, the camera path should be defined in the LSE system (local coordinate system that is tangential to the ellipsoid).
Title: Re: ANIMATION
Post by: mcstieg on December 01, 2019, 04:13:16 PM
Hello Alexey!

I've tried to output the animation as a video file.
I'm able to create the track, set duration and fov but I cannot output the video.

Tested chunk.camera_track.save(path) but the file size is 10 kb ...

Can you help?

THANK YOU!
Title: Re: ANIMATION
Post by: Alexey Pasumansky on December 02, 2019, 01:34:34 PM
Hello mcstieg,

camera_track.save saves only the created track, not the video. At the moment there's no API command for the animation rendering, so you should use Capture button on the Animation pane in GUI mode to render the video and save it to the file.
Title: Re: ANIMATION
Post by: mcstieg on December 02, 2019, 01:44:12 PM
Thank you for the quick reply!

Is it possible to implement the export function as a python functionality in one the next updates?

Thanks again!
Title: Re: ANIMATION
Post by: Alexey Pasumansky on December 02, 2019, 03:15:57 PM
At the moment we are not planning such functionality, as the video recording is mostly based on Qt functionality and couldn't be used in stand-alone Metashape Python module.