GaussNoise

Targets:
image
Image Types:uint8, float32

Add Gaussian (normal) noise to the image. i.i.d. per pixel (or per block if scaled). Use for robustness to sensor or transmission noise.

Noise standard deviation and mean are sampled from configurable ranges and scaled to image dtype (255 for uint8, 1.0 for float32). Optional per-channel sampling and lower-resolution noise for speed.

Arguments
std_range
tuple[float, float]
[0.2,0.44]

Range for noise standard deviation as a fraction of the max value (255 for uint8, 1.0 for float32). In [0, 1]. Default: (0.2, 0.44).

mean_range
tuple[float, float]
[0,0]

Range for noise mean as a fraction of max. In [-1, 1]. Default: (0.0, 0.0).

per_channel
bool
false

If True, sample noise per channel; else same noise for all. Default: False.

noise_scale_factor
float
1

If < 1, noise is generated at lower resolution and resized (faster, coarser). 1 = per-pixel. In (0, 1]. Default: 1.0.

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)
>>>
>>> transform = A.GaussNoise(std_range=(0.1, 0.2), p=1.0)
>>> noisy_image = transform(image=image)["image"]
Notes
  • std_range and mean_range are in [0, 1] / [-1, 1]; scaled by 255 (uint8) or used directly (float32).
  • per_channel=False: faster, same noise on all channels (grayscale-like on RGB).
  • per_channel=True: different noise per channel (colored noise).
  • noise_scale_factor < 1 trades speed for noise granularity.
See Also
  • FilmGrain: Luminance-dependent, spatially correlated (film-like) noise.
  • ShotNoise: Poisson noise in linear space; sensor-realistic for low light.