gaussian_noise

colibri.optics.functional.gaussian_noise(y, snr)[source]

Add Gaussian noise to an image based on a specified signal-to-noise ratio (SNR).

\[\mathbf{\tilde{y}} = \mathbf{y} + n\]

where \(n\) is a Gaussian noise with zero mean and variance \(\sigma^2\) such that is derived from the SNR and the power of \(\mathbf{y}\).

Parameters:
  • y (torch.Tensor) – Original image tensor with shape (B, L, M, N).

  • snr (float) – Desired signal-to-noise ratio in decibels (dB).

Returns:

Noisy image tensor with the same shape as input.

Return type:

torch.Tensor