skimage2.restoration.estimate_sigma#

skimage2.restoration.estimate_sigma(image, average_sigmas=False, *, channel_axis=None)[source]#

Robust wavelet-based estimator of the (Gaussian) noise standard deviation.

Parameters:
imagendarray

Image for which to estimate the noise standard deviation.

average_sigmasbool, optional

If true, average the channel estimates of sigma. Otherwise return a list of sigmas corresponding to each channel.

channel_axisint or None, optional

If None, the image is assumed to be grayscale (single-channel). Otherwise, this parameter indicates which axis of the array corresponds to channels.

Added in version 0.19: channel_axis was added in 0.19.

Returns:
sigmafloat or list

Estimated noise standard deviation(s). If multichannel is True and average_sigmas is False, a separate noise estimate for each channel is returned. Otherwise, the average of the individual channel estimates is returned.

Notes

This function assumes the noise follows a Gaussian distribution. The estimation algorithm is based on the median absolute deviation of the wavelet detail coefficients as described in section 4.2 of [1].

References

[1]

D. L. Donoho and I. M. Johnstone. “Ideal spatial adaptation by wavelet shrinkage.” Biometrika 81.3 (1994): 425-455. DOI:10.1093/biomet/81.3.425

Examples

>>> import _skimage2.data
>>> from _skimage2 import img_as_float
>>> img = img_as_float(_skimage2.data.camera())
>>> sigma = 0.1
>>> rng = np.random.default_rng()
>>> img = img + sigma * rng.standard_normal(img.shape)
>>> sigma_hat = estimate_sigma(img, channel_axis=None)