Forum

Author Topic: Remove Mask  (Read 4538 times)

Kirill

  • Newbie
  • *
  • Posts: 9
    • View Profile
Remove Mask
« on: September 06, 2023, 04:35:09 PM »
How to remove masks from photos using Python?

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15168
    • View Profile
Re: Remove Mask
« Reply #1 on: September 06, 2023, 06:14:17 PM »
Hello Kirill,

If you need to remove all the masks for the cameras in the active chunk, you can use the following script:
Code: [Select]
chunk = Metashape.app.document.chunk
for camera in chunk.cameras:
   camera.mask = None
Best regards,
Alexey Pasumansky,
Agisoft LLC

kelso

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Remove Mask
« Reply #2 on: January 30, 2024, 08:50:33 PM »
Hi there,

I have used this script with agisoft 2.0.2 and it was working fine. I am using another script to copy different masks on different cameras in a multirig and need this one if the masking went wrong. However now I am using agisoft 2.1 and since I have used the reset skript, its is resetting my masks instead of copying. Seems like the camera.mask = NONE is stuck for all cameras.

Can plz somebody help me fixing this? thx

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15168
    • View Profile
Re: Remove Mask
« Reply #3 on: January 31, 2024, 05:11:02 PM »
Hello kelso,

Do you mean that the following block of code is failing or is not resetting the masks for all cameras in the active chunk?

Code: [Select]
chunk = Metashape.app.document.chunk
for camera in chunk.cameras:
   camera.mask = None
Best regards,
Alexey Pasumansky,
Agisoft LLC