Dear Agisoft Users,
I am struggling to write a script to do a certain process in photos. The idea is to:
1. choose cameras (selected or by given range define by labels) from chunk or group (name),
2. open photos one by one in a new tab with certain delay (e.g. 1000ms),
3. capture view by given parameters,
4. save images to directory.
I wrote the script that captures view only for Model View Mode. I've got sth like this:
import Metashape
import os
# Checking compatibility
compatible_major_version = "1.6"
found_major_version = ".".join(Metashape.app.version.split('.')[:2])
if found_major_version != compatible_major_version:
raise Exception("Incompatible Metashape version: {} != {}".format(found_major_version, compatible_major_version))
def capture_view():
doc = Metashape.app.document
if not len(doc.chunks):
raise Exception("No chunks!")
print("Script started...")
chunk = doc.chunk #active chunk, if there's any in the project
for camera in chunk.cameras:
camera = chunk.cameras[0]
capture = Metashape.app.model_view.captureView(width = 600, height = 450, transparent = False, hide_items = True)
capture.save('E:/Capture/' + camera.label + '_cv.png')
print("Script finished!")
label = "Custom menu/Capture View"
Metashape.app.addMenuItem(label, capture_view)
print("To execute this script press {}".format(label))
I couldn't find the module such as captureView for camera view (open image).
I will be very grateful for any support in this topic.