Agisoft Metashape

Agisoft Metashape => Python and Java API => Topic started by: claire on December 03, 2019, 08:04:48 AM

Title: Parameters to import masks on a chunk
Post by: claire on December 03, 2019, 08:04:48 AM
Hello,

I'm running a python script to import masks on my chunk.
They are well reconized the problem is I do not know what source and what operation I should use.
The masks are in white where no data should be considered and equal to 0 or else.

I used :chunk.importMasks(path= "C:\\Users\\TOTO\\Documents\\Masks\\Mask_%s\\"%year ,\
                  source=Metashape.MaskSourceAlpha,operation=Metashape.MaskOperationReplacement,tolerance=10)

  but the masks appeared in white on my pictures.

Can you give me a hand please.

All the best

Claire
Title: Re: Parameters to import masks on a chunk
Post by: Alexey Pasumansky on December 04, 2019, 08:04:05 PM
Hello Claire,

If you are using black&white files with the masks, you should should specify Metashape.MaskSourceFile option for the importMasks method. Replacement - default operation, should be used, if there are no pre-loaded masks for the images which you would like to keep somehow.