Forum

Author Topic: Unable to export plan_mission with CaptureTrack class  (Read 142 times)

Tom2L

  • Newbie
  • *
  • Posts: 10
    • View Profile
Unable to export plan_mission with CaptureTrack class
« on: May 24, 2022, 04:09:43 PM »
Hi all,
Once again, thanks for the amazing software and support that you all provide.
I'm actually trying to create the capture photos ... option of the plan mission in python using metashape API.
In order to do so, i'd like to export the camera track as a .path file, then use it the viewpoint and capture viewpoint class.

Unfortunately, i do not manage to export the camera track as a .path file.
I actually  have a metashape project with an animation generated thanks to the mission planning that i am trying to export using python
My code is :
Code: [Select]
doc = Metashape.Document()
doc.open(path=r"C:\Users\Thomas\Documents\projet_x2.psx")
chunk = doc.chunk
camtrack = Metashape.CameraTrack
camtrack.chunk = chunk
camtrack.save(r"C:\Users\Thomas\Documents\CameraTrack.path")
and i always get the error message
Code: [Select]
TypeError: descriptor 'save' for 'Metashape.Metashape.CameraTrack' objects doesn't apply to a 'str' object
that i can't solve.
In the api reference, the save option is really confusing and reclame a path as a string, that i can't solve :
Quote
save(path[, file_format, max_waypoints, projection])
Save camera track to file.
Parameters
• path (string) – Path to camera track file
• file_format (string) – File format. “deduce”: - Deduce from extension, “path”: Path,
“earth”: Google Earth KML, “pilot”: DJI Pilot KML, “trinity”: Asctec Trinity CSV, “au-
topilot”: Asctec Autopilot CSV, “litchi”: Litchi CSV
• max_waypoints (int) – Max waypoints per flight
• projection (CoordinateSystem) – Camera track coordinate system.

I also tried loading an existing .path file with :
Code: [Select]
camtrack.load(r"C:\Users\Thomas\Documents\CameraTrack_001.path")
but i get the same error.
Is anyone able to help me with this ?

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 13729
    • View Profile
Re: Unable to export plan_mission with CaptureTrack class
« Reply #1 on: May 24, 2022, 04:31:51 PM »
Hello Tom,

I think you should use:
Code: [Select]
chunk.camera_track.save(r"C:\Users\Thomas\Documents\CameraTrack.path")It would save the active camera track according to the input path.
Best regards,
Alexey Pasumansky,
Agisoft LLC

Tom2L

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Unable to export plan_mission with CaptureTrack class
« Reply #2 on: May 24, 2022, 05:06:22 PM »
Amazing man!
As always thank you for the support you provide