Skip to content
class

GaussianBlur

extendsPhotometricTransform[SigmaParam]
GaussianBlur(blur_limit: tuple[int, int] = (3, 7), sigma_limit: float | tuple[float, float] = 0.0, p: float = 0.5)

Gaussian blur with random kernel size and sigma (Albumentations GaussianBlur).

Samples an odd kernel size from blur_limit and a sigma from sigma_limit; when sigma is left at zero the OpenCV default 0.3 * ((k - 1) * 0.5 - 1.0) + 0.8 is used so the kernel matches cv2's auto-sigma policy.

Parameters

blur_limit(int, int)= (3, 7)
Inclusive range for the kernel size; both ends are rounded up to the next odd integer.
sigma_limitfloat or (float, float)= 0.0
Range for the Gaussian sigma. A scalar v expands to (0.0, v); 0 triggers the OpenCV auto-sigma formula.
pfloat= 0.5
Probability of applying the transform.

Examples

>>> import lucid, lucid.utils.transforms as T
>>> tf = T.GaussianBlur(p=1.0)
>>> tuple(tf(T.Image(lucid.rand(3, 32, 32))).data.shape)
(3, 32, 32)

Used by 1

Constructors

1
dunder

__init__

→None
__init__(blur_limit: tuple[int, int] = (3, 7), sigma_limit: float | tuple[float, float] = 0.0, p: float = 0.5)

Instance methods

1
fn

make_params

→SigmaParam
make_params(img: Tensor)

Sample per-call random parameters for GaussianBlur.

Parameters

Image tensor; not inspected, carried through for dispatch.

Returns

SigmaParam

Carries ksize (odd kernel side from blur_limit) and sigma (Gaussian standard deviation).

Notes

A non-positive sampled sigma falls back to OpenCV's kernel-derived default 0.3 * ((k - 1) * 0.5 - 1.0) + 0.8 so the Gaussian matches cv2's auto-sigma policy.

Dunder methods

1