The same procedure employed for 1-D signal denoising can also be applied to image denoising.
After implementing the double-density DWT, real double-density dual-tree DWT, and complex double-density dual-tree DWT for 2-D signals, we can develop three different methods using these DWTs to remove noise from an image. The double-density DWT method will be discussed first.
1. 2-D Double-Density DWT Thresholding Method
Matlab Function - double_S2D.m
function y = double_S2D(x,T)
% x: noise signal
% T: threshold
[af, sf] = filters1;
J = 4;
w = double_f2D(x,J,af);
% loop thru scales
for j = 1:J
% loop thru subbands
for s = 1:8
w{j}{s} = soft(w{j}{s},T);
end
end
y = double_i2D(w,J,sf);
This program method takes two input parameters, the first being the noisy image, whose dimension is 512 x 512, and the second being the threshold point. We take the forward DWT over four scales and apply soft thresholding to the wavelet coefficients through all the subbands. After thresholding, we then take the inverse wavelet transform.
The following example shows how to convert an image to double data type, how to create a noisy image and display the denoised image. Note that we use a threshold value of 20, which is the optimal threshold point for this case.
EXAMPLE (NOISE ATTENUATION)
s1 = double(imread('peppers.jpg')); % load image as a double
s = s1(:,:,3); % convert to a 2-D image
figure(1) % display original image
imagesc(s)
colormap(gray)
axis image
title('Original Image')
x = s + 20*randn(size(s)); % add Gaussian noise to image
figure(2) % display noisy image
imagesc(x)
colormap(gray)
axis image
title('Noisy Image')
T = 15; % choose a threshold of 15
y = double_S2D(x,T); % denoise using Double-Density DWT
figure(3) % diplay denoised image
imagesc(y)
colormap(gray)
axis image
title('Denoised Image')
This program produces the following denoised image:
From the resulting image, we can see the denoising capability of 2-D double-density DWT.
2. 2-D Double-Density Dual-Tree Real DWT Thresholding Method
Now we want to improve the effect by using 2-D double-density dual-tree real DWT. The optimal threshold value for this method is 15. The MATLAB function doubledual_R2D.m and the denoised image are shown below.
Matlab Function - doubledual_R2D.m
function y = doubleden_R2D(x,T);
[Faf, Fsf] = FSdoubledualfilt;
[af, sf] = doubledualfilt;
J = 4;
w = doubledualtree_f2D(x,J,Faf,af);
% loop thru scales:
for j = 1:J
% loop thru subbands
for s1 = 1:2
for s2 = 1:8
w{j}{s1}{s2} = soft(w{j}{s1}{s2},T);
end
end
end
y = doubledualtree_i2D(w,J,Fsf,sf);
This program results in the following denoised image:
From the resulting image, we can see the denoising capability of 2-D double-density DWT.
3. 2-D Double-Density Dual-Tree Complex DWT Thresholding Method
Now we want to improve the effect by using 2-D double-density dual-tree real DWT. The optimal threshold value for this method is 15. The MATLAB function doubledual_C2D.m and the denoised image are shown below.
Matlab Function - doubledual_C2D.m
function y = doubledual_C2D(x,T)
[Faf, Fsf] = FSdoubledualfilt;
[af, sf] = doubledualfilt;
I = sqrt(-1);
J = 4;
w = cplxdoubledual_f2D(x,J,Faf,af);
% loop thru scales
for j = 1:J
% loop thru subbands
for s1 = 1:2
for s2 = 1:8
C = w{j}{1}{s1}{s2} + I*w{j}{2}{s1}{s2};
C = soft(C,T);
w{j}{1}{s1}{s2} = real(C);
w{j}{2}{s1}{s2} = imag(C);
end
end
end
y = cplxdoubledual_i2D(w,J,Fsf,sf);
The program results in the following denoised image:
We can see that 2-D double-density method is best in terms of noise attenuation by the following "RMS Error vs. Threshold Point" plot.
Summary of Programs:
- double_S2D.m - 2-D double-density DWT denoising method
- doubledual_R2D.m - 2-D double-density dual-tree real DWT denoising method
- doubledual_C2D.m - 2-D double-density dual-tree complex DWT denoising method
- Example_ImageDenoising1.m - Image denoising example using double-density DWT method
- Example_ImageDenoising2.m - Image denoising example using double-density dual-tree real DWT method
- Example_ImageDenoising3.m - Image denoising example using double-density dual-tree complex DWT method
- double_den2.m - Compute RMS error vs. threshold point for double-density DWT method
- real_den2.m - Compute RMS error vs. threshold point for double-density dual-tree real DWT method
- complex_den2.m - Compute RMS error vs. threshold point for double-density dual-tree complex DWT method
- Example_Compare2DThresholds.m - Plot RMS error vs. threshold point
- Example_DentalDenoising.m - Digital Dental X-Ray Denoising Examples
- soft.m - Soft thresholding
Download all framelet programs here. |