RandomSnow

Targets:
image
Image Types:uint8, float32

Add snow overlay via bleach (brightness threshold) or texture (noise-based overlay). Good for winter or snowy-scene robustness in outdoor imagery.

Two methods: "bleach" brightens pixels above a threshold (faster, simpler); "texture" adds a depth-weighted snow layer with sparkle (more realistic, heavier).

Arguments
snow_point_range
tuple[float, float]
[0.1,0.3]

Range for snow intensity threshold in (0, 1). Default: (0.1, 0.3).

brightness_coeff
float
2.5

Brightness multiplier for snow; must be > 0. Default: 2.5.

method
bleach | texture
bleach

"bleach" = threshold + brighten; "texture" = noise-based overlay with depth and sparkle. Default: "bleach".

p
float
0.5

Probability of applying the transform. Default: 0.5.

Examples
>>> import numpy as np
>>> import albumentations as A
>>> image = np.random.randint(0, 256, [100, 100, 3], dtype=np.uint8)

# Default usage (bleach method)
>>> transform = A.RandomSnow(p=1.0)
>>> snowy_image = transform(image=image)["image"]

# Using texture method with custom parameters
>>> transform = A.RandomSnow(
...     snow_point_range=(0.2, 0.4),
...     brightness_coeff=2.0,
...     method="texture",
...     p=1.0
... )
>>> snowy_image = transform(image=image)["image"]
Notes
  • "bleach": brightness threshold in HLS; pixels above snow_point are scaled by brightness_coeff. Fast, less realistic.
  • "texture": HSV brightness boost, Gaussian noise texture, depth gradient (stronger at top), alpha blend, blue tint, sparkle. More realistic, heavier.
See Also
  • RandomRain: Rain streaks and blur for rainy conditions.
  • RandomFog: Patch-based fog without depth.
  • AtmosphericFog: Depth-dependent fog via scattering.