1 function y = denoising_dwt(x)
2 % Local Adaptive Image Denoising Algorithm
8 % y - the corresponding denoised image
10 % Adjust windowsize and the corresponding filter
12 windowfilt = ones(1,windowsize)/windowsize;
20 x = symextend(x,2^(L-1));
26 % Noise variance estimation using robust median estimator..
28 Nsig = median(abs(tmp(:)))/0.6745;
34 Y_coefficient = W{scale}{dir};
37 Y_parent = W{scale+1}{dir};
39 % extent Y_parent to make the matrix size be equal to Y_coefficient
40 Y_parent = expand(Y_parent);
42 % Signal variance estimation
44 Wsig = conv2(windowfilt,windowfilt,(Y_coefficient).^2,'same');
45 Ssig = sqrt(max(Wsig-Nsig.^2,eps));
47 % Threshold value estimation
48 T = sqrt(3)*Nsig^2./Ssig;
51 W{scale}{dir} = bishrink(Y_coefficient,Y_parent,T);
61 y = y(2^(L-1)+1:2^(L-1)+512,2^(L-1)+1:2^(L-1)+512);