Forum

Author Topic: Export Masks  (Read 1653 times)

Paulo

  • Hero Member
  • *****
  • Posts: 1100
    • View Profile
Export Masks
« on: March 25, 2020, 06:58:16 PM »
Hi all,

I am trying to develop a script to Export masks as in GUI:

- file type set to Single channel mask image;
- file name template set to {filename}mask.png;
- apply to All cameras;
- and set to  C:\Users\paul.pelletier\Downloads\ASV_Demo4-5m-blurred\Out folder.

In Python reference, I can only find Tasks.ExportMasks.

for this I define:
Code: [Select]
task = Metashape.Tasks.ExportMasks()and define the cameras to apply task to with:
Code: [Select]
task.cameras = [camera.key for camera in chunk.cameras]and try to define path as:
Code: [Select]
task.path =’C:\Users\paul.pelletier\Downloads\ASV_Demo4-5m-blurred\Out\{filename}_mask.png’but i get following error:
task.path =’C:\Users\paul.pelletier\Downloads\ASV_Demo4-5m-blurred\Out\{filename}_mask.png’
                ^
SyntaxError: invalid character in identifier

and where do I define file type^?

Please help as I am lost....
Best Regards,
Paul Pelletier,
Surveyor

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14099
    • View Profile
Re: Export Masks
« Reply #1 on: March 25, 2020, 08:26:56 PM »
Hello Paul,

I recommend to use "/" or "\\" instead of "\" (single backslash) symbol in the path string.

Also make sure that the quotes sign are conventional symbols and are not some special characters.

Try this line instead:
Code: [Select]
task.path = "C:/Users/paul.pelletier/Downloads/ASV_Demo4-5m-blurred/Out/{filename}_mask.png"
Best regards,
Alexey Pasumansky,
Agisoft LLC

Paulo

  • Hero Member
  • *****
  • Posts: 1100
    • View Profile
Re: Export Masks
« Reply #2 on: March 25, 2020, 10:56:24 PM »
Thanks a lot, Alexey,

that was the problem!
Best Regards,
Paul Pelletier,
Surveyor