Total members 11786 |It is currently Fri Jul 19, 2019 6:45 am Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





wiener filter implementation
Code:

function ex 
= wienerFilter(y,h,sigma,gamma,alpha);
%
%
 ex = wienerFilter(y,h,sigma,gamma,alpha);
%
%
 Generalized Wiener filter using parameter alpha. When
% alpha = 1, it is the Wiener filter. It is also called
% Regularized inverse filter.
%
%
 Reference: Richb's paper
% Created: Tue May 4 16:24:06 CDT 1999, Huipin Zhang

N = size(y,1);
Yf = fft2(y);
Hf = fft2(h,N,N);
Pyf = abs(Yf).^2/N^2;

% direct implementation of the regularized inverse filter, 
% when alpha = 1, it is the Wiener filter
% Gf = conj(Hf).*Pxf./(abs(Hf.^2).*Pxf+alpha*sigma^2);
%
% Since we don'
t know Pxf, the following 
% handle singular case (zero case)
sHf = Hf.*(abs(Hf)>0)+1/gamma*(abs(Hf)==0);
iHf = 1./sHf;
iHf = iHf.*(abs(Hf)*gamma>1)+gamma*abs(sHf).*iHf.*(abs(sHf)*gamma<=1);

Pyf = Pyf.*(Pyf>sigma^2)+sigma^2*(Pyf<=sigma^2);
Gf = iHf.*(Pyf-sigma^2)./(Pyf-(1-alpha)*sigma^2);

%
 max(max(abs(Gf).^2)) % should be equal to gamma^2
% Restorated image without denoising
eXf 
= Gf.*Yf;
ex = real(ifft2(eXf));

return
 





Author:
Mastermind
User avatar Posts: 2707
Have thanks: 74 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : wiener filter implementation
 applying wiener filter to image     -  
 stream filter to append     -  
 Transform Rotate Filter     -  
 Median filter to image     -  
 apply mean filter to image     -  
 apply prewitt filter to image     -  
 Applying canny filter to image     -  
 apply laplacian filter to image     -  
 apply robert filter to image     -  
 Image Custom Filter In Java     -  



Topic Tags

Matlab Image






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com