Hi everyone,
I'm a beginner on Metashape, as well as on Python.
My goal is to automate in Python a processing chain to create an orthomosaic from a folder of multispectral photos (from a DJI Mavic 3M drone).
For the moment, I've created an Agisoft batch job (XML) that meets my needs.
By any chance, is there a tool that can convert a batch job into a Python script?
If not, I'd like to take advantage of this thread to work on this script step by step, with the help of anyone who can help me.
So I'll start by sharing the first bits of code I've written (I confess, with the help of ChatGPT), which could perhaps be optimised?
import Metashape
import os
# Params
project_path = r"D:\PROJECTPATH\MYPROJECT.psx"
photos_folder = r"D:\PHOTOSPATH"
# Create project and chunk
doc = Metashape.Document()
doc.save(path=project_path)
chunk = doc.addChunk()
# Photos import
# I don't think this method is optimal: it should be possible to specify that this is a multi-camera system
photo_list = [os.path.join(photos_folder, photo) for photo in os.listdir(photos_folder) if photo.lower().endswith(('.jpg', '.jpeg', '.png', '.tif', '.tiff'))]
chunk.addPhotos(photo_list)
doc.save()
Thank you very much for any help you can give me, or any examples you can send me links to.