Deblur image using Wiener filter
J = deconvwnr(I,PSF,NSR)
J = deconvwnr(I,PSF,NCORR,ICORR)
J = deconvwnr(I,PSF,NSR) deconvolves image I using the Wiener filter algorithm, returning deblurred image J. Image I can be an N-dimensional array. PSF is the point-spread function with which I was convolved. NSR is the noise-to-signal power ratio of the additive noise. NSR can be a scalar or a spectral-domain array of the same size as I. Specifying 0 for the NSR is equivalent to creating an ideal inverse filter.
The algorithm is optimal in a sense of least mean square error between the estimated and the true images.
J = deconvwnr(I,PSF,NCORR,ICORR) deconvolves image I, where NCORR is the autocorrelation function of the noise and ICORR is the autocorrelation function of the original image. NCORR and ICORR can be of any size or dimension, not exceeding the original image. If NCORR or ICORR are N-dimensional arrays, the values correspond to the autocorrelation within each dimension. If NCORR or ICORR are vectors, and PSF is also a vector, the values represent the autocorrelation function in the first dimension. If PSF is an array, the 1-D autocorrelation function is extrapolated by symmetry to all non-singleton dimensions of PSF. If NCORR or ICORR is a scalar, this value represents the power of the noise of the image.
I can be of class uint8, uint16, int16, single, or double. Other inputs have to be of class double. J has the same class as I.
Create a noisy, blurry image and then apply the deconvwnr filter to deblur it.
Display the original image.
I = im2double(imread('cameraman.tif')); imshow(I); title('Original Image (courtesy of MIT)');
Simulate a motion blur.
LEN = 21; THETA = 11; PSF = fspecial('motion', LEN, THETA); blurred = imfilter(I, PSF, 'conv', 'circular'); figure, imshow(blurred)
Simulate additive noise.
noise_mean = 0; noise_var = 0.0001; blurred_noisy = imnoise(blurred, 'gaussian', ... noise_mean, noise_var); figure, imshow(blurred_noisy) title('Simulate Blur and Noise')
Try restoration assuming no noise.
estimated_nsr = 0; wnr2 = deconvwnr(blurred_noisy, PSF, estimated_nsr); figure, imshow(wnr2) title('Restoration of Blurred, Noisy Image Using NSR = 0')
Try restoration using a better estimate of the noise-to-signal-power ratio.
estimated_nsr = noise_var / var(I(:)); wnr3 = deconvwnr(blurred_noisy, PSF, estimated_nsr); figure, imshow(wnr3) title('Restoration of Blurred, Noisy Image Using Estimated NSR');
"Digital Image Processing", R. C. Gonzalez & R. E. Woods, Addison-Wesley Publishing Company, Inc., 1992.