Forum

Author Topic: Access Tweaks outside of Metashape GUI?  (Read 553 times)

mindful_drone

  • Newbie
  • *
  • Posts: 5
    • View Profile
Access Tweaks outside of Metashape GUI?
« 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.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 13910
    • View Profile
Re: Access Tweaks outside of Metashape GUI?
« Reply #1 on: June 03, 2022, 03:42:30 PM »
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:

Code: [Select]
task = Metashape.Tasks.BuildDepthMaps()
task.downscale = 2
task.filter_mode = Metashape.FilterMode.MildFiltering
task["pm_enable"] = "0"
task.apply(chunk)
Best regards,
Alexey Pasumansky,
Agisoft LLC

Paulo

  • Hero Member
  • *****
  • Posts: 1023
    • View Profile
Re: Access Tweaks outside of Metashape GUI?
« Reply #2 on: June 03, 2022, 04:28:09 PM »
Hi Alexey,

What does
Code: [Select]
task["pm_enable"] = "0"
mean? pm_enable True or False

PS. I got the answer
Code: [Select]
task["pm_enable"] = "0" # PM_version False
task["pm_enable"] = "1" # PM_version True
« Last Edit: June 03, 2022, 07:23:43 PM by Paulo »
Best Regards,

Paul Pelletier,
Surveyor

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 13910
    • View Profile
Re: Access Tweaks outside of Metashape GUI?
« Reply #3 on: June 06, 2022, 03:18:47 PM »
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.
Best regards,
Alexey Pasumansky,
Agisoft LLC

mindful_drone

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Access Tweaks outside of Metashape GUI?
« Reply #4 on: June 09, 2022, 04:54:21 PM »
Hi Alexey,

This saved us so much trouble, thank you so much!

Best regards