SOFTTHRES image denoising by soft thresholding in the wavelet domain. This routine uses 4 scales QMF orthogonal wavelets (see MatlabPyrTools). By default, threshold is derived from the standard deviation of the noise using values optimized to minimize MSE in a set of natural images. Precomputed threshold values are given for variances in the range [0,1600]. The user may specify a different threshold factor, i.e. thres=thres_factor*sigma_n. Soft 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=1) assuming Gaussian noise [Simoncelli99]). SYNTAX: im_r = softthres(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, threshold is estimated 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 0002 % SOFTTHRES image denoising by soft thresholding in the wavelet domain. 0003 % 0004 % This routine uses 4 scales QMF orthogonal wavelets (see MatlabPyrTools). 0005 % By default, threshold is derived from the standard deviation of the noise 0006 % using values optimized to minimize MSE in a set of natural images. 0007 % Precomputed threshold values are given for variances in the range 0008 % [0,1600]. 0009 % The user may specify a different threshold factor, i.e. 0010 % thres=thres_factor*sigma_n. 0011 % 0012 % Soft thresholding [Donoho95] can be derived in a Bayesian framework using 0013 % a very specific combination of noise and image models (MAP estimation of 0014 % Generalized Laplacian PDF signal with particular kurtosis (k=1) assuming 0015 % Gaussian noise [Simoncelli99]). 0016 % 0017 % SYNTAX: 0018 % 0019 % im_r = softthres(im_n,variance,thres_factor); 0020 % 0021 % Input 0022 % ----- 0023 % * im_n = noisy image 0024 % * variance = noise variance 0025 % * thres_factor = factor on the noise deviation to set the threshold (optional!) 0026 % If no factor is provided, threshold is estimated 0027 % Output 0028 % ------ 0029 % * im_r = denoised image 0030 % 0031 % REFERENCES: 0032 % 0033 % [Donoho95] David L. Donoho and Iain M. Johnstone. Adapting to unknown 0034 % smoothness via wavelet shrinkage. J. Am. Stat. Assoc., 90:1200�1224, 1995. 0035 % [Simoncelli99] E. Simoncelli. Bayesian denoising of visual images in the wavelet 0036 % domain. In Bayesian Inference in Wavelet Based Models, pages 291�308. 0037 % Springer-Verlag, NY, 1999. 0038 % [Simoncelli97] E. Simoncelli. MatlabPyrTools. Matlab toolbox for wavelet transforms 0039 % http://www.cns.nyu.edu/~lcv/software.php 0040 function A=softthres(Im2,var,varargin) 0041 [pyr,ind]=buildWpyr(Im2,4); 0042 if nargin==2 0043 if var<=1600 0044 fun=[1,4,10,17,25,34,44,55,66;0,5,10,15,20,25,30,35,40]; 0045 des=sqrt(var); 0046 t=interp1(fun(2,:),fun(1,:),des); 0047 s = abs(pyr) - t; 0048 s = (s + abs(s))/2; 0049 y = sign(pyr).*s; 0050 PYR2=y; 0051 PYR2(65281:65536)=pyr(65281:65536); 0052 A=reconWpyr(PYR2,ind); 0053 else 0054 disp(' Input variance exceeds the precomputed range for') 0055 disp(' optimal threshold estimation.') 0056 disp(' Please specify threshold factor on variance!') 0057 A=0; 0058 end 0059 else 0060 t=varargin{1}*sqrt(var); 0061 s = abs(pyr) - t; 0062 s = (s + abs(s))/2; 0063 y = sign(pyr).*s; 0064 PYR2=y; 0065 PYR2(65281:65536)=pyr(65281:65536); 0066 A=reconWpyr(PYR2,ind); 0067 end