pysdic.add_gaussian_noise#

add_gaussian_noise(image, *, std, seed=None)[source]#

Add a white Gaussian noise to an image (read noise of a sensor).

\[g' = g + \sigma \, \mathcal{N}(0, 1)\]

The noise is drawn independently for each value of the image (each pixel and channel).

See also

The functions of the simulation of an acquisition, in the usual order: add_gaussian_blur(), add_poisson_noise(), add_gaussian_noise(), add_salt_and_pepper_noise() and quantize_image().

Parameters:
  • image (ArrayLike) – The image, an array of any shape (e.g. \((H, W)\) or \((H, W, C)\)) with finite values.

  • std (Real) – The standard deviation \(\sigma \geq 0\) of the noise, in gray levels.

  • seed (Optional[Integral], optional (default: None)) – The seed of the random generator (numpy.random.default_rng), non-negative. If None, the noise is different at each call.

Returns:

The noisy image, a float64 array with the shape of image.

Return type:

numpy.ndarray

Raises:

ValueError – If the image has non-finite values or an input has a wrong value.