bundles / skimage 0.26.1rc0.dev0+git20260530.b607368ff / skimage / restoration / deconvolution / unsupervised_wiener
function
skimage.restoration.deconvolution:unsupervised_wiener
source: /dev/scikit-image/src/skimage/restoration/deconvolution.py :143
Signature
def unsupervised_wiener ( image , psf , reg = None , user_params = None , is_real = True , clip = True , * , rng = None ) Summary
Unsupervised Wiener-Hunt deconvolution.
Extended Summary
Return the deconvolution with a Wiener-Hunt approach, where the hyperparameters are automatically estimated. The algorithm is a stochastic iterative process (Gibbs sampler) described in the reference below. See also wiener function.
Parameters
image: ndarray of shape (M, N)The input degraded image.
psf: ndarrayThe impulse response (input image's space) or the transfer function (Fourier space). Both are accepted. The transfer function is automatically recognized as being complex (
np.iscomplexobj(psf)).reg: ndarray, optionalThe regularisation operator. The Laplacian by default. It can be an impulse response or a transfer function, as for the psf.
user_params: dict, optionalDictionary of parameters for the Gibbs sampler. Accepted keys are:
threshold
threshold
burnin
burnin
min_num_iter
min_num_iter
max_num_iter
max_num_iter
callback
callback
clip: bool, optionalTrue by default. If true, pixel values of the result above 1 or under -1 are thresholded for skimage pipeline compatibility.
rng: {`numpy.random.Generator`, int}, optionalPseudo-random number generator. By default, a PCG64 generator is used (see numpy.random.default_rng). If
rngis an int, it is used to seed the generator.
Returns
x_postmean: ndarray of shape (M, N)The deconvolved image (the posterior mean).
chains: dictThe keys
noiseandpriorcontain the chain list of noise and prior precision respectively.
Notes
The estimated image is design as the posterior mean of a probability law (from a Bayesian analysis). The mean is defined as a sum over all the possible images weighted by their respective probability. Given the size of the problem, the exact sum is not tractable. This algorithm use of MCMC to draw image under the posterior law. The practical idea is to only draw highly probable images since they have the biggest contribution to the mean. At the opposite, the less probable images are drawn less often since their contribution is low. Finally, the empirical mean of these samples give us an estimation of the mean, and an exact computation with an infinite sample set.
Examples
from skimage import color, data, restoration img = color.rgb2gray(data.astronaut()) from scipy.signal import convolve2d psf = np.ones((5, 5)) / 25 img = convolve2d(img, psf, 'same') rng = np.random.default_rng() img += 0.1 * img.std() * rng.standard_normal(img.shape) deconvolved_img = restoration.unsupervised_wiener(img, psf)✓
Aliases
-
skimage.restoration.unsupervised_wiener