HARDTHRES image denoising by hard thresholding in the wavelet domain. This routine uses 4 scales QMF orthogonal wavelets (see MatlabPyrTools). By default it uses the 3*sigma_n rule to set the threshold. The user may specify a different threshold factor, i.e. thres=thres_factor*sigma_n. Hard thresholding [Donoho95] can be derived in a Bayesian framework using a very specific combination of noise and image models (MAP estimation of Generalized Laplacian PDF signal with particular kurtosis (k=0.5) assuming Gaussian noise [Simoncelli99]). SYNTAX: im_r = hardthres(im_n,variance,thres_factor); Input ----- * im_n = noisy image * variance = noise variance * thres_factor = factor on the noise deviation to set the threshold (optional!) If no factor is provided the 3*sigma_n rule is applied. Output ------ * im_r = denoised image REFERENCES: [Donoho95] David L. Donoho and Iain M. Johnstone. Adapting to unknown smoothness via wavelet shrinkage. J. Am. Stat. Assoc., 90:1200-1224, 1995. [Simoncelli99] E. Simoncelli. Bayesian denoising of visual images in the wavelet domain. In Bayesian Inference in Wavelet Based Models, pages 291-308. Springer-Verlag, NY, 1999. [Simoncelli97] E. Simoncelli. MatlabPyrTools. Matlab toolbox for wavelet transforms http://www.cns.nyu.edu/~lcv/software.php
0001 % HARDTHRES image denoising by hard thresholding in the wavelet domain. 0002 % 0003 % This routine uses 4 scales QMF orthogonal wavelets (see MatlabPyrTools). 0004 % By default it uses the 3*sigma_n rule to set the threshold. 0005 % The user may specify a different threshold factor, i.e. 0006 % thres=thres_factor*sigma_n. 0007 % 0008 % Hard thresholding [Donoho95] can be derived in a Bayesian framework using 0009 % a very specific combination of noise and image models (MAP estimation of 0010 % Generalized Laplacian PDF signal with particular kurtosis (k=0.5) assuming 0011 % Gaussian noise [Simoncelli99]). 0012 % 0013 % SYNTAX: 0014 % 0015 % im_r = hardthres(im_n,variance,thres_factor); 0016 % 0017 % Input 0018 % ----- 0019 % * im_n = noisy image 0020 % * variance = noise variance 0021 % * thres_factor = factor on the noise deviation to set the threshold (optional!) 0022 % If no factor is provided the 3*sigma_n rule is applied. 0023 % Output 0024 % ------ 0025 % * im_r = denoised image 0026 % 0027 % REFERENCES: 0028 % 0029 % [Donoho95] David L. Donoho and Iain M. Johnstone. Adapting to unknown 0030 % smoothness via wavelet shrinkage. J. Am. Stat. Assoc., 90:1200-1224, 1995. 0031 % [Simoncelli99] E. Simoncelli. Bayesian denoising of visual images in the wavelet 0032 % domain. In Bayesian Inference in Wavelet Based Models, pages 291-308. 0033 % Springer-Verlag, NY, 1999. 0034 % [Simoncelli97] E. Simoncelli. MatlabPyrTools. Matlab toolbox for wavelet transforms 0035 % http://www.cns.nyu.edu/~lcv/software.php 0036 0037 function A=hardthres(Im,var,varargin) 0038 0039 NW=4; 0040 0041 [pyr,ind]=buildWpyr(Im,NW); 0042 pyr2=abs(pyr); 0043 pyr_sg=sign(pyr); 0044 0045 if nargin==2 0046 res=3*sqrt(var); 0047 else 0048 res=varargin{1}*sqrt(var); 0049 end 0050 0051 PYR2=zeros(1,length(pyr2)); 0052 PYR2(find(pyr2>res))=pyr2(find(pyr2>res)); 0053 0054 PYR2(65281:65536)=pyr(65281:65536); 0055 PYR3=PYR2.*pyr_sg'; 0056 0057 A=reconWpyr(PYR3',ind);