Deblur image using Wiener filter
J = deconvwnr(I,PSF,NSR)
J = deconvwnr(I,PSF,NCORR,ICORR)
J = deconvwnr(I,PSF,NSR) deconvolves
I using the Wiener filter algorithm, returning
be an N-dimensional array.
PSF is the point-spread
function with which
I was convolved.
the noise-to-signal power ratio of the additive noise.
be a scalar or a spectral-domain array of the same size as
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
NCORR is the
autocorrelation function of the noise and
the autocorrelation function of the original image.
be of any size or dimension, not exceeding the original image. If
N-dimensional arrays, the values correspond to the autocorrelation
within each dimension. If
PSF is also a vector, the values represent
the autocorrelation function in the first dimension. If
an array, the 1-D autocorrelation function is extrapolated by symmetry
to all non-singleton dimensions of
a scalar, this value represents the power of the noise of the image.
The output image
J could exhibit ringing
introduced by the discrete Fourier transform used in the algorithm.
To reduce the ringing, use
I = edgetaper(I,PSF)
I can be of class
double. Other inputs have to be of class
the same class as
Read image into the workspace and display it.
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.