ShotNoise
Targets:
image
volume
Image Types:uint8, float32
Apply shot noise to the image by modeling photon counting as a Poisson process.
Shot noise (also known as Poisson noise) occurs in imaging due to the quantum nature of light. When photons hit an imaging sensor, they arrive at random times following Poisson statistics. This transform simulates this physical process in linear light space by:
- Converting to linear space (removing gamma)
- Treating each pixel value as an expected photon count
- Sampling actual photon counts from a Poisson distribution
- Converting back to display space (reapplying gamma)
The noise characteristics follow real camera behavior:
- Noise variance equals signal mean in linear space (Poisson statistics)
- Brighter regions have more absolute noise but less relative noise
- Darker regions have less absolute noise but more relative noise
- Noise is generated independently for each pixel and color channel
Arguments
scale_rangetuple[float, float]
[0.1,0.3]
Range for sampling the noise scale factor. Represents the reciprocal of the expected photon count per unit intensity. Higher values mean more noise:
- scale = 0.1: ~100 photons per unit intensity (low noise)
- scale = 1.0: ~1 photon per unit intensity (moderate noise)
- scale = 10.0: ~0.1 photons per unit intensity (high noise) Default: (0.1, 0.3)
pfloat
0.5
Probability of applying the transform. Default: 0.5
Examples
>>> import numpy as np
>>> import albumentations as A
>>> # Generate synthetic image
>>> image = np.random.randint(0, 256, [100, 100, 3], dtype=np.uint8)
>>> # Apply moderate shot noise
>>> transform = A.ShotNoise(scale_range=(0.1, 1.0), p=1.0)
>>> noisy_image = transform(image=image)["image"]Notes
- Performs calculations in linear light space (gamma = 2.2)
- Preserves the image's mean intensity
- Memory efficient with in-place operations
- Thread-safe with independent random seeds
References
- Shot noisehttps://en.wikipedia.org/wiki/Shot_noise
- Original paperhttps://doi.org/10.1002/andp.19183622304 (Schottky, 1918)
- Poisson processhttps://en.wikipedia.org/wiki/Poisson_point_process
- Gamma correctionhttps://en.wikipedia.org/wiki/Gamma_correction