Blur transforms (augmentations.blur.transforms)¶
class
albumentations.augmentations.blur.transforms.AdvancedBlur
(blur_limit=(3, 7), sigmaX_limit=(0.2, 1.0), sigmaY_limit=(0.2, 1.0), rotate_limit=90, beta_limit=(0.5, 8.0), noise_limit=(0.9, 1.1), always_apply=False, p=0.5)
[view source on GitHub]
¶
Blur the input image using a Generalized Normal filter with a randomly selected parameters. This transform also adds multiplicative noise to generated kernel before convolution.
Parameters:
Name | Type | Description |
---|---|---|
blur_limit |
maximum Gaussian kernel size for blurring the input image.
Must be zero or odd and in range [0, inf). If set to 0 it will be computed from sigma
as |
|
sigmaX_limit |
Gaussian kernel standard deviation. Must be in range [0, inf).
If set single value |
|
sigmaY_limit |
Same as |
|
rotate_limit |
Range from which a random angle used to rotate Gaussian kernel is picked. If limit is a single int an angle is picked from (-rotate_limit, rotate_limit). Default: (-90, 90). |
|
beta_limit |
Distribution shape parameter, 1 is the normal distribution. Values below 1.0 make distribution tails heavier than normal, values above 1.0 make it lighter than normal. Default: (0.5, 8.0). |
|
noise_limit |
Multiplicative factor that control strength of kernel noise. Must be positive and preferably
centered around 1.0. If set single value |
|
p |
float |
probability of applying the transform. Default: 0.5. |
Reference: https://arxiv.org/abs/2107.10833
Targets: image Image types: uint8, float32
class
albumentations.augmentations.blur.transforms.Blur
(blur_limit=7, always_apply=False, p=0.5)
[view source on GitHub]
¶
Blur the input image using a random-sized kernel.
Parameters:
Name | Type | Description |
---|---|---|
blur_limit |
int, [int, int] |
maximum kernel size for blurring the input image. Should be in range [3, inf). Default: (3, 7). |
p |
float |
probability of applying the transform. Default: 0.5. |
Targets: image
Image types: uint8, float32
class
albumentations.augmentations.blur.transforms.Defocus
(radius=(3, 10), alias_blur=(0.1, 0.5), always_apply=False, p=0.5)
[view source on GitHub]
¶
Apply defocus transform. See https://arxiv.org/abs/1903.12261.
Parameters:
Name | Type | Description |
---|---|---|
radius |
[int, int] or int |
range for radius of defocusing. If limit is a single int, the range will be [1, limit]. Default: (3, 10). |
alias_blur |
[float, float] or float |
range for alias_blur of defocusing (sigma of gaussian blur). If limit is a single float, the range will be (0, limit). Default: (0.1, 0.5). |
p |
float |
probability of applying the transform. Default: 0.5. |
Targets: image
Image types: Any
class
albumentations.augmentations.blur.transforms.GaussianBlur
(blur_limit=(3, 7), sigma_limit=0, always_apply=False, p=0.5)
[view source on GitHub]
¶
Blur the input image using a Gaussian filter with a random kernel size.
Parameters:
Name | Type | Description |
---|---|---|
blur_limit |
int, [int, int] |
maximum Gaussian kernel size for blurring the input image.
Must be zero or odd and in range [0, inf). If set to 0 it will be computed from sigma
as |
sigma_limit |
float, [float, float] |
Gaussian kernel standard deviation. Must be in range [0, inf).
If set single value |
p |
float |
probability of applying the transform. Default: 0.5. |
Targets: image
Image types: uint8, float32
class
albumentations.augmentations.blur.transforms.GlassBlur
(sigma=0.7, max_delta=4, iterations=2, always_apply=False, mode='fast', p=0.5)
[view source on GitHub]
¶
Apply glass noise to the input image.
Parameters:
Name | Type | Description |
---|---|---|
sigma |
float |
standard deviation for Gaussian kernel. |
max_delta |
int |
max distance between pixels which are swapped. |
iterations |
int |
number of repeats. Should be in range [1, inf). Default: (2). |
mode |
str |
mode of computation: fast or exact. Default: "fast". |
p |
float |
probability of applying the transform. Default: 0.5. |
Targets: image
Image types: uint8, float32
Reference: | https://arxiv.org/abs/1903.12261 | https://github.com/hendrycks/robustness/blob/master/ImageNet-C/create_c/make_imagenet_c.py
class
albumentations.augmentations.blur.transforms.MedianBlur
(blur_limit=7, always_apply=False, p=0.5)
[view source on GitHub]
¶
Blur the input image using a median filter with a random aperture linear size.
Parameters:
Name | Type | Description |
---|---|---|
blur_limit |
int |
maximum aperture linear size for blurring the input image. Must be odd and in range [3, inf). Default: (3, 7). |
p |
float |
probability of applying the transform. Default: 0.5. |
Targets: image
Image types: uint8, float32
class
albumentations.augmentations.blur.transforms.MotionBlur
(blur_limit=7, allow_shifted=True, always_apply=False, p=0.5)
[view source on GitHub]
¶
Apply motion blur to the input image using a random-sized kernel.
Parameters:
Name | Type | Description |
---|---|---|
blur_limit |
int |
maximum kernel size for blurring the input image. Should be in range [3, inf). Default: (3, 7). |
allow_shifted |
bool |
if set to true creates non shifted kernels only, otherwise creates randomly shifted kernels. Default: True. |
p |
float |
probability of applying the transform. Default: 0.5. |
Targets: image
Image types: uint8, float32
class
albumentations.augmentations.blur.transforms.ZoomBlur
(max_factor=1.31, step_factor=(0.01, 0.03), always_apply=False, p=0.5)
[view source on GitHub]
¶
Apply zoom blur transform. See https://arxiv.org/abs/1903.12261.
Parameters:
Name | Type | Description |
---|---|---|
max_factor |
[float, float] or float |
range for max factor for blurring. If max_factor is a single float, the range will be (1, limit). Default: (1, 1.31). All max_factor values should be larger than 1. |
step_factor |
[float, float] or float |
If single float will be used as step parameter for np.arange.
If tuple of float step_factor will be in range |
p |
float |
probability of applying the transform. Default: 0.5. |
Targets: image
Image types: Any