Skip to content
class

MotionBlur

extendsPhotometricTransform[MotionParam]
MotionBlur(blur_limit: int = 7, p: float = 0.5)

Directional (linear streak) motion blur (Albumentations MotionBlur).

Samples an odd kernel size and a streak angle in [0, 180)°, draws a 1-pixel-wide line through the kernel centre at that angle, then convolves the normalised kernel with the image — approximates the look of a camera panning while the shutter is open.

Parameters

blur_limitint= 7
Inclusive upper bound on the kernel size; rounded up to the next odd integer.
pfloat= 0.5
Probability of applying the transform.

Examples

>>> import lucid, lucid.utils.transforms as T
>>> tf = T.MotionBlur(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: int = 7, p: float = 0.5)

Instance methods

1
fn

make_params

→MotionParam
make_params(img: Tensor)

Sample per-call random parameters for MotionBlur.

Parameters

Image tensor; not inspected, carried through for dispatch.

Returns

MotionParam

Carries ksize (odd kernel side, [3, blur_limit]) and angle in degrees sampled uniformly from [0, 180).

Notes

Even kernel-size draws are forced to the next odd integer. Angles outside [0, 180) are unnecessary since the streak kernel is symmetric under 180° rotation.

Dunder methods

1