how many coefficients were retained after reconstruction (IDWT)? and how does the quality of reconstruction vary with respect to number of DWT coefficients?

1 次查看(过去 30 天)
I have used inbuilt 'wdencmp' function for image denoising and my image got denoised, but I want to know how many coefficients were retained after reconstruction (IDWT)?
dwtmode('sym');
[thr,sorh,keepapp]=ddencmp('den','wv',input);
imgden=wdencmp('gbl',input,'db7',7,thr,sorh,keepapp);
and how does the quality of reconstruction vary with respect to number of DWT coefficients?

回答(1 个)

Abhimenyu
Abhimenyu 2024-4-22
编辑:Abhimenyu 2024-4-23
Hi Santhosh,
As per the information shared, I could infer that you are trying to use the "wdencmp" MATLAB function to perform denoising or compression on an input signal (an image). The function syntax shared specifies global thresholding for denoising:
imgden = wdencmp('gbl', input, 'db7', 7, thr, sorh, keepapp);
Here, "input" is the original image, "db7" specifies the Daubechies wavelet, "7" is the decomposition level, "thr" is the threshold for denoising, "sorh" ('s' for soft, 'h' for hard) specifies the thresholding rule, and "keepapp" is a logical value indicating whether to keep the approximation coefficients at the coarsest level.
To find out how many coefficients were retained after the denoising process, the wavelet decomposition can be done using MATLAB's "wavedec2" function (for 2D signals like images). Then thresholding can be applied to finally count the coefficients.
Please follow the below-mentioned example MATLAB code to find out the number of retained coefficients:
% Perform wavelet decomposition
[C, S] = wavedec2(input, 7, 'db7');
% Apply the same thresholding as in wdencmp
% Note: You might need to adjust this part to match the exact thresholding used in wdencmp
C_thresh = C;
C_thresh(abs(C) < thr) = 0;
% Count the non-zero coefficients after thresholding
num_retained_coeffs = nnz(C_thresh);
% Output the number of retained coefficients
fprintf('Number of retained coefficients: %d\n', num_retained_coeffs);
The quality of reconstruction depends on the number of "DWT" coefficients retained. When an image is denoised using wavelets, a threshold is applied to the coefficients. Higher thresholds result in fewer coefficients being retained, leading to more aggressive denoising but potentially loss of fine details. Conversely, lower thresholds retain more coefficients, preserving more details but allowing some noise to remain. Experimenting with different thresholds allows to find a balance between denoising and preserving image features.
Generally, as the number of retained coefficients (i.e., decrease the threshold) increase, the quality of reconstruction improves, but the denoising effect may decrease. Conversely, reducing the number of coefficients (increasing the threshold) enhances denoising but may lead to the loss of important image information. It’s essential to strike a balance based on the specific application and desired trade-off between noise reduction and feature preservation.
For a better understanding on the "wavedec2" function, please follow this MATLAB R2024a documentation link: https://www.mathworks.com/help/wavelet/ref/wavedec2.html
I hope this helps!

类别

Help CenterFile Exchange 中查找有关 Denoising and Compression 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by