Simulate fog by overlaying semi-transparent circles and blending with a fog color. Good for driving or outdoor robustness to weather.
Fog is built from random circles with controllable intensity; an image-size-dependent Gaussian blur is applied to the result. Patch-based (no depth); for distance-dependent fog use AtmosphericFog.
fog_coef_rangeRange for fog intensity coefficient in [0, 1]. Default: (0.3, 1).
alpha_coefTransparency of the fog circles in [0, 1]. Default: 0.08.
pProbability of applying the transform. Default: 0.5.
>>> import numpy as np
>>> import albumentations as A
>>> image = np.random.randint(0, 256, [100, 100, 3], dtype=np.uint8)
# Default usage
>>> transform = A.RandomFog(p=1.0)
>>> foggy_image = transform(image=image)["image"]
# Custom fog intensity range
>>> transform = A.RandomFog(fog_coef_range=(0.3, 0.8), p=1.0)
>>> foggy_image = transform(image=image)["image"]
# Adjust fog transparency
>>> transform = A.RandomFog(fog_coef_range=(0.2, 0.5), alpha_coef=0.1, p=1.0)
>>> foggy_image = transform(image=image)["image"]