How to use wiener filter?
    25 views (last 30 days)
  
       Show older comments
    
    Ibrahim Musa Adi
 on 12 Jun 2020
  
    
    
    
    
    Commented: Bjorn Gustavsson
      
 on 12 Jun 2020
            Im really new with matlab and image processing, so i follow some journal how to do wiener filter and im using this code to blur the image:
LEN1 = 15; % Panjang blur (satuan: pixel)
THETA1 = 15; % sudut blur (satuan: derajat)
PSF1 = fspecial('motion', LEN1, THETA1);
Blurred1 = imfilter(I, PSF1, 'conv', 'circular');
and this is the code to do the wiener filter:
wnr1 = deconvwnr(Blurred1, PSF1);
But, the result is different from the journal that i saw,  this is the blured version:

and this is fixed version, after the wiener filter code:

Is this the correct result?i think im doing it wrong, i dont this is the correct result
If im doing it wrong, what should i add or change?
Thank you
0 Comments
Accepted Answer
  Bjorn Gustavsson
      
 on 12 Jun 2020
        If you read the help for deconwnr you see that there is a third input, NSR, for the image Noise-to-Signal-Ratio. Since the Wiener-deconvolution is a high-frequency-amplifying operation. If you look at the code in deconvwnr you will see how the deconvolution is done in the Fourier-domain:
% Compute the Wiener restoration filter:
%
%                   H*(k,l)
% G(k,l)  =  ------------------------------
%            |H(k,l)|^2 + S_u(k,l)/S_x(k,l)
%
% where S_u is the signal power spectrum and S_x is the noise power
% spectrum.
%
% To minimize issues associated with divisions, the equation form actually
% implemented here is this:
%
%                   H*(k,l) S_x(k,l)
% G(k,l)  =  ------------------------------
%            |H(k,l)|^2 S_x(k,l) + S_u(k,l)
%
Where H is the Fourier-transform of your PSF and S_u and S_xis the noise-power and image-power respectively (that get handled resp estimated by deconvwnr). If you dont send in a noise-level it seems deconvwnr assumes that power to be zero, which leads to noise-amplification (H^*/|H|^2 will grow towards infinity where |H| goes to zero - which it will do for high frequencies). Since you're working with finite precision this will manifest as amplification of the highest frequencies - where discretisation-noise will be amplified. Try to send in some noise-levels to deconvwnr to see how that reduces this effect.
HTH
2 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
