mask_tools module#
- class selective_blur.masking.mask_tools.MaskEditor(mask: ndarray)[source]#
Bases:
objectClass to refine the mask generated automatically with SAM2.
- auto_denoise()[source]#
Function to clean automatically the mask by removing small segmented areas. The principle is the following:
dimension of the closed True areas in the mask is computed
the areas are placed in increasing order and divided into deciles
small areas are converted into False, so that they wil no be included in the mask anymore. The parameter that defines the threshold (selected via interactive slider) under which areas are considered “small” is threshold, which refers to the decile of the area distribution.