Add depth-dependent fog via the atmospheric scattering equation and a synthetic depth map. Use for outdoor and driving robustness to haze.
Unlike RandomFog (which overlays circular fog patches), this transform uses a physically-based scattering model: farther pixels (by synthetic depth) get more fog, producing realistic distance-dependent haze. Depth is derived from image position (linear, diagonal, or radial), not from a real depth map.
Formula: result = image * exp(-density * depth) + fog_color * (1 - exp(-density * depth))
density_rangeRange for fog density. Higher values give thicker fog. Default: (1.0, 3.0).
fog_colorFog color per channel, e.g. (R, G, B) for 3 channels. Length must match image channels. Default: (200, 200, 200).
depth_modeHow synthetic depth is generated:
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)
>>> transform = A.AtmosphericFog(density_range=(1.0, 2.5), depth_mode="linear", p=1.0)
>>> result = transform(image=image)["image"]
>>> # Radial fog (center clear, edges foggy)
>>> transform_radial = A.AtmosphericFog(density_range=(1.5, 3.0), depth_mode="radial", p=1.0)
>>> result_radial = transform_radial(image=image)["image"]