At what level to threshold when using multilevel wavelet transform ?

11 views (last 30 days)
  1. I = imread('cameraman.tif');
  2. n = prod( size(I) );
  3. I = double(I);
  4. Ib = I+25*randn(size(I));% add noise
  5. [C,S] = wavedec2(Ib,2,'bior3.7');
  6. DH = detcoef2('all',C,S,1);% extract details coefficient from level 1
  7. DH = DH(:);
  8. delta = median( abs(DH) ) / 0.6745;
  9. thr = delta * sqrt(2*log(n));
  10. NC = wthcoef2('t',C,S,1,thr,'s'); % i use the soft threshold
  11. X = waverec2(NC, S, 'bior3.7');
  12. figure;
  13. imagesc(Ib); title('Noisy Image'); colormap gray;
  14. figure;
  15. imagesc(X); title('Denoised 1st level coeffs'); colormap gray;
At line 10 when thresholding they use level 1,
but in line 5 while decomposing they use level 2.
Can anyone please explain why it is not thresholded at level 2?
Would that matter if we decompose at higher levels and still threshold at level 1?
I tried to run the example with level 1,2 in wavedec2 and used wthcoef2 at level 1 and level 2.
After reconstruction, results were better when thresholded at level 1. But decomposing at level 2 does not cause any effect if we thresold at level 1 as used in the above code.
Please help me understand better.

Answers (1)

Hari
Hari on 24 Feb 2025
Hi Aparnnaa,
I understand that you are working with a multilevel wavelet transform for image denoising and want to know why the thresholding is applied at level 1 despite decomposing the image at level 2.
I assume you are asking the rationale behind choosing a specific level for thresholding and whether decomposing at a higher level affects the results when thresholding at a lower level.
Understand Wavelet Decomposition Levels:
Decomposing at a higher level (e.g., level 2) captures both fine and coarse details, but thresholding is typically more effective at the first level where noise is more prominent.
[C,S] = wavedec2(Ib, 2, 'bior3.7'); % Decomposes the image to level 2
Thresholding at Level 1:
Level 1 coefficients contain high-frequency noise, making it an ideal candidate for thresholding. This is why the threshold is applied at level 1.
DH = detcoef2('all', C, S, 1); % Extracts level 1 detail coefficients
delta = median(abs(DH)) / 0.6745; % Noise estimation
thr = delta * sqrt(2 * log(n)); % Threshold calculation
Effect of Higher-Level Decomposition:
Decomposing at higher levels allows for better separation of noise and signal across multiple scales, but thresholding at level 1 often suffices for denoising.
NC = wthcoef2('t', C, S, 1, thr, 's'); % Apply threshold at level 1
Reconstruction and Comparison:
Reconstruct the image using thresholded coefficients and compare results. Thresholding at level 1 often yields better denoising results due to effective noise suppression.
X = waverec2(NC, S, 'bior3.7'); % Reconstructs the image
Experiment with Different Levels:
You can experiment by decomposing and thresholding at different levels to observe changes in denoising performance. However, level 1 is generally optimal for noise reduction.
Refer to the documentation of “wavedec2” and “wthcoef2” functions to know more about their usage:
Hope this helps!

Categories

Find more on Wavelet Toolbox in Help Center and File Exchange

Tags

Products


Release

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!