BlurMask
- class lib.align.aligned_mask.BlurMask(blur_type: Literal['gaussian', 'normalized'], mask: ndarray, kernel: int | float, is_ratio: bool = False, passes: int = 1)
Bases:
objectFactory class to return the correct blur object for requested blur type.
Works for square images only. Currently supports Gaussian and Normalized Box Filters.
- Parameters:
blur_type (T.Literal['gaussian', 'normalized']) – The type of blur to use
mask (np.ndarray) – The mask to apply the blur to
kernel (int | float) – Either the kernel size (in pixels) or the size of the kernel as a ratio of mask size
is_ratio (bool) – Whether the given
kernelparameter is a ratio or not. IfTruethen the actual kernel size will be calculated from the given ratio and the mask size. IfFalsethen the kernel size will be set directly from thekernelparameter. Default:Falsepasses (int) – The number of passes to perform when blurring. Default:
1
Example
>>> print(mask.shape) (128, 128, 1) >>> new_mask = BlurMask("gaussian", mask, 3, is_ratio=False, passes=1).blurred >>> print(new_mask.shape) (128, 128, 1)
Attributes Summary
The final mask with blurring applied.
Attributes Documentation
- blurred
The final mask with blurring applied.
- property blurred: ndarray
The final mask with blurring applied.