Hello Alexey,
the masks are imported before. I calculate a model (Low Quality) and use this as the basis for the masking operation. For a better result, I recalculate the process, but this time using the masks.
The same process through the GUI works fine. Only through Python does it seem that the masks are ignored because the sparse point cloud also contains the points outside the masked area.
Here is my code:
# import exterior orientation and create mask from model
chunk.importCameras(tmp+'/Kameras.xml',format=PhotoScan.CamerasFormatXML)
chunk.matchPhotos(accuracy=PhotoScan.HighAccuracy, filter_mask=False, keypoint_limit=40000, tiepoint_limit=4000)
chunk.buildPoints()
#define Bounding Box
createBB(chunk)
chunk.buildDepthMaps(quality=PhotoScan.LowQuality, filter=PhotoScan.AggressiveFiltering)
chunk.buildDenseCloud()
chunk.buildModel(surface=PhotoScan.Arbitrary, interpolation=PhotoScan.EnabledInterpolation)
chunk.importMasks('', source=PhotoScan.MaskSourceModel, operation=PhotoScan.MaskOperationReplacement, tolerance=10,cameras=chunk.cameras)
# import exterior orientation and new calculation with masks
chunk.importCameras(tmp+'/Kameras.xml',format=PhotoScan.CamerasFormatXML)
chunk.matchPhotos(accuracy=PhotoScan.HighAccuracy, generic_preselection=False, filter_mask=True)
chunk.buildPoints()
...