KeCoDe_denosing applies wavelet-based image denoising algorithms to the input 256*256 gray scale image. This version is thought only for gaussian noise. Note that the kernel denoising colud be applied to different kinds of noise, however some parameters have to be precomputed (see model 4 or [Laparra10] for details). The available denoising algorithms and the corresponding Matlab functions are: * model 1 - Hard Thresholding [Donoho95,Simoncelli99].... hardthres.m Assumes the noise variance is known. Applies the threshold=3*sigma_n rule. * model 2 - Soft Thresholding [Donoho95,Simoncelli99].... softthres.m Assumes the noise variance is known. Applies the threshold=3*sigma_n rule. * model 3 - Bayesian denoising assuming (1) Gaussian noise of known variance and, (2) Gaussian marginals for the wavelet coefficients of natural images [Figueiredo01]........................ bayesian_gauss_margin.m * model 4 - Kernel regularization in the wavelet domain with kernels inspired in mutual information measures [Laparra10] ..... mi_kernel_denoising.m NOTE: The function 'mi_kernel_denoising.m' admits precomputed parameters in order to apply the algorithm in different kinds of noise. See the JPEG example below. In 'KeCoDe_denoising.m' the algorithm is prepared to work with Gaussian nosie. In order to use 'mi_kernel_denoising.m' on different kind noise it requires some knowledge on the signal and the noise: 1- Average variance of the signal in the wavelet domain to set the SVM penalization profile, C_i. This variance profile is an intrinsic feature of natural images and can be estimated from a natural image database. 2- Average standard deviation of the noise in the wavelet domain to set the insensitivity profile, epsilon_i. This deviation profile can be estimated from noise samples. 3- 2D histogram of the noise in the spatial domain to look for the SVM parameters that better identify the noise. SVM parameter optimization can be done by minimizing the KL divergence between the known noise histogram and the histogram of the estimated noise. The code provided in KeCoDe skips all the off-line preprocessing steps: 1- Average variance of natural images in the steerable domain was precomputed from the McGill natural image data base (http://tabby.vision.mcgill.ca/) and stored in the file: "C_profile.mat" 2- Average standard deviation profile of Gaussian noise and JPEG noise was precomputed from (1) noise realizations and (2) JPEG compressed (at MATLAB quality compression Q=7) examples respectively, and stored in the files: "Epsilon_profile_Gaussian.mat" "Epsilon_profile_JPEG_Q7.mat" If the Q factor of the JPEG quantization is modified, or another noise source is present, the epsilon profile should be computed by looking at the average wavelet transform of noise samples. For signal independent noise sources, the unit variance profile scales as: epsilon_profile=sqrt(Var)*unit_variance_epsilon_profile.. Therefore, for white noise Gaussian sources the code provided here is general assuming known variance (as the other algorithms). 3- KLD-based SVR selection is not implemented in the code. Instead, fixed (near optimum) values are given in each case (Gaussian and JPEG), in the ranges described in [Laparra08]. [Laparra10] V. Laparra, J. Gutierrez, G. Camps and J. Malo Image Denoising with Kernels based on Natural Image Relations Journal of Machine Learning Research 11(Feb):873?903, 2010 [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. [Figueiredo01] M. Figueiredo and R. Nowak. Wavelet-based image estimation: an empirical Bayes approach using Jeffrey's noninformative prior. IEEE Transactions on Image Processing, 10(9):1322-1331, 2001. [Simoncelli97] E. Simoncelli. MatlabPyrTools. Matlab toolbox for wavelet transforms http://www.cns.nyu.edu/~lcv/software.php [Foi06] Alessandro Foi. Routine 'function_stdEst2D.m' for automatic noise variance estimation. Tampere University of Technology - 2005-2006 http://www.cs.tut.fi/~lasip/2D SYNTAX: Im_d = KeCoDe_denoising(Im,model,var) Input variables: ---------------- * Im_n : 256*256 noisy image matrix double precision numbers in the range [0 255] * MODEL : 1-4 (see above models explanation) * Var : Variance of Gaussian noise. This parameter is optinal. If it is not provided, the variance will be estimated using 'function_stdEst2D.m' [Foi06] Output: ------- * Im_d : Denoised image
0001 % 0002 % KeCoDe_denosing applies wavelet-based image denoising algorithms to the 0003 % input 256*256 gray scale image. This version is thought only for gaussian 0004 % noise. Note that the kernel denoising colud be applied to different 0005 % kinds of noise, however some parameters have to be precomputed (see 0006 % model 4 or [Laparra10] for details). 0007 % 0008 % The available denoising algorithms and the corresponding Matlab functions are: 0009 % 0010 % * model 1 - Hard Thresholding [Donoho95,Simoncelli99].... hardthres.m 0011 % Assumes the noise variance is known. 0012 % Applies the threshold=3*sigma_n rule. 0013 % 0014 % * model 2 - Soft Thresholding [Donoho95,Simoncelli99].... softthres.m 0015 % Assumes the noise variance is known. 0016 % Applies the threshold=3*sigma_n rule. 0017 % 0018 % * model 3 - Bayesian denoising assuming (1) Gaussian noise of known variance 0019 % and, (2) Gaussian marginals for the wavelet coefficients of natural 0020 % images [Figueiredo01]........................ bayesian_gauss_margin.m 0021 % 0022 % * model 4 - Kernel regularization in the wavelet domain with kernels inspired in 0023 % mutual information measures [Laparra10] ..... mi_kernel_denoising.m 0024 % 0025 % NOTE: The function 'mi_kernel_denoising.m' admits precomputed parameters 0026 % in order to apply the algorithm in different kinds of noise. See the 0027 % JPEG example below. 0028 % 0029 % In 'KeCoDe_denoising.m' the algorithm is prepared to work with 0030 % Gaussian nosie. In order to use 'mi_kernel_denoising.m' on different 0031 % kind noise it requires some knowledge on the signal and 0032 % the noise: 0033 % 1- Average variance of the signal in the wavelet domain to set 0034 % the SVM penalization profile, C_i. This variance profile is an 0035 % intrinsic feature of natural images and can be estimated from 0036 % a natural image database. 0037 % 2- Average standard deviation of the noise in the wavelet domain to 0038 % set the insensitivity profile, epsilon_i. This deviation profile 0039 % can be estimated from noise samples. 0040 % 3- 2D histogram of the noise in the spatial domain to look for the 0041 % SVM parameters that better identify the noise. SVM parameter 0042 % optimization can be done by minimizing the KL divergence between 0043 % the known noise histogram and the histogram of the estimated 0044 % noise. 0045 % The code provided in KeCoDe skips all the off-line 0046 % preprocessing steps: 0047 % 1- Average variance of natural images in the steerable domain was 0048 % precomputed from the McGill natural image data base 0049 % (http://tabby.vision.mcgill.ca/) and stored in the file: 0050 % "C_profile.mat" 0051 % 2- Average standard deviation profile of Gaussian noise and 0052 % JPEG noise was precomputed from (1) noise realizations and 0053 % (2) JPEG compressed (at MATLAB quality compression Q=7) examples 0054 % respectively, and stored in the files: 0055 % "Epsilon_profile_Gaussian.mat" 0056 % "Epsilon_profile_JPEG_Q7.mat" 0057 % If the Q factor of the JPEG quantization is modified, or another noise 0058 % source is present, the epsilon profile should be computed by looking at 0059 % the average wavelet transform of noise samples. 0060 % For signal independent noise sources, the unit variance profile 0061 % scales as: epsilon_profile=sqrt(Var)*unit_variance_epsilon_profile.. 0062 % Therefore, for white noise Gaussian sources the code provided here 0063 % is general assuming known variance (as the other algorithms). 0064 % 3- KLD-based SVR selection is not implemented in the code. Instead, fixed 0065 % (near optimum) values are given in each case (Gaussian and JPEG), in the 0066 % ranges described in [Laparra08]. 0067 % 0068 % [Laparra10] V. Laparra, J. Gutierrez, G. Camps and J. Malo 0069 % Image Denoising with Kernels based on Natural Image Relations 0070 % Journal of Machine Learning Research 11(Feb):873?903, 2010 0071 % 0072 % [Donoho95] David L. Donoho and Iain M. Johnstone. Adapting to unknown 0073 % smoothness via wavelet shrinkage. J. Am. Stat. Assoc., 90:1200-1224, 1995. 0074 % 0075 % [Simoncelli99] E. Simoncelli. Bayesian denoising of visual images in the wavelet 0076 % domain. In Bayesian Inference in Wavelet Based Models, pages 291-308. 0077 % Springer-Verlag, NY, 1999. 0078 % 0079 % [Figueiredo01] M. Figueiredo and R. Nowak. Wavelet-based image estimation: 0080 % an empirical Bayes approach using Jeffrey's noninformative prior. 0081 % IEEE Transactions on Image Processing, 10(9):1322-1331, 2001. 0082 % 0083 % [Simoncelli97] E. Simoncelli. MatlabPyrTools. Matlab toolbox for wavelet transforms 0084 % http://www.cns.nyu.edu/~lcv/software.php 0085 % 0086 % [Foi06] Alessandro Foi. Routine 'function_stdEst2D.m' for automatic 0087 % noise variance estimation. Tampere University of 0088 % Technology - 2005-2006 0089 % http://www.cs.tut.fi/~lasip/2D 0090 % 0091 % SYNTAX: 0092 % Im_d = KeCoDe_denoising(Im,model,var) 0093 % 0094 % Input variables: 0095 % ---------------- 0096 % * Im_n : 256*256 noisy image matrix double precision numbers in the range [0 255] 0097 % * MODEL : 1-4 (see above models explanation) 0098 % * Var : Variance of Gaussian noise. This parameter is optinal. 0099 % If it is not provided, the variance will be estimated using 0100 % 'function_stdEst2D.m' [Foi06] 0101 % 0102 % Output: 0103 % ------- 0104 % * Im_d : Denoised image 0105 % 0106 function Im_d = KeCoDe_denoising(Im_n,model,var) 0107 warning('off','MATLAB:dispatcher:InexactMatch') 0108 Im_n=double(Im_n); 0109 if exist('var') 0110 else 0111 dev = function_stdEst2D(Im_n); 0112 var = dev^2; 0113 end 0114 if model==1 0115 Im_d = hardthres(Im_n,var); 0116 elseif model==2 0117 Im_d = softthres(Im_n,var); 0118 elseif model==3 0119 Im_d = bayesian_gauss_margin(Im_n,var); 0120 elseif model==4 0121 C = 3000; 0122 S = 4; 0123 epsilon = 2; 0124 load Epsilon_profile_Gaussian.mat 0125 epsilon_profile = perfil_eps*sqrt(var); 0126 Im_d = mi_kernel_denoising(Im_n,epsilon,C,S,epsilon_profile); 0127 end