Agisoft Metashape
Agisoft Metashape => Python and Java API => Topic started by: Paulo 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:
task = Metashape.Tasks.ExportMasks()
and define the cameras to apply task to with:
task.cameras = [camera.key for camera in chunk.cameras]
and try to define path as:
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....
-
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:
task.path = "C:/Users/paul.pelletier/Downloads/ASV_Demo4-5m-blurred/Out/{filename}_mask.png"
-
Thanks a lot, Alexey,
that was the problem!