Agisoft Metashape
Agisoft Metashape => Python and Java API => Topic started by: mindful_drone on June 03, 2022, 01:44:38 PM
-
Hi Alexey, all,
Is there a way to set tweaks flags using the Python API outside of the Metashape application/GUI?
I'd like to use the tweak to use the old depth maps functionality (specifically BuildDepthMaps/pm_enable) in a Python script, but the settings don't actually update outside of the GUI/application environment when I set them.
Screenshots attached to show behaviour inside vs outside of the GUI. From the GUI in white, and outside of GUI in dark mode.
-
Hello mindful_drone,
In Python API you can use tweaks for the processing operations as hidden parameters of the processing tasks, see the example below:
task = Metashape.Tasks.BuildDepthMaps()
task.downscale = 2
task.filter_mode = Metashape.FilterMode.MildFiltering
task["pm_enable"] = "0"
task.apply(chunk)
-
Hi Alexey,
What does task["pm_enable"] = "0"
mean? pm_enable True or False
PS. I got the answer
task["pm_enable"] = "0" # PM_version False
task["pm_enable"] = "1" # PM_version True
-
Hello Paul,
Yes, that is correct.
Boolean type (true/false) tweaks should be defined as "0" or "1" string values via Python, where "0" is False and "1" - True.
-
Hi Alexey,
This saved us so much trouble, thank you so much!
Best regards