How to image de-noise whit (Wavelet) using dwt3 and idwt3

2 ビュー (過去 30 日間)
lech king
lech king 2020 年 11 月 27 日
回答済み: Suraj Kumar 2025 年 4 月 3 日
Hello
I have implemented using dwt2 and idwt2
But I have not used dwt3 and idwt3 so far. Is it possible to help me with these commands to de-noiseize ??
Thank you
My code:
pic=imread('lena.jpg');
pic1=rgb2gray(pic);
pic11=im2double(pic1);
pic2 = imnoise(pic1,'gaussian',0.0001);
pic3=im2double(pic2);
%%%%%%Symlet%%%%%%%%%%%%
wavename='sym2';
[LoD,HiD]=wfilters(wavename,'d');
%First level
[cA,cH,cV,cD]=dwt2(pic3,LoD,HiD,'mode','per');
%Second level
[cAA,cAH,cAV,cAD]=dwt2(cA,LoD,HiD,'mode','per');
Level1=[Norm(cAA),Norm(cAH);Norm(cAV),Norm(cAD)];
pic4=([Level1,Norm(cH);Norm(cV),Norm(cD)]);
%%%%%%%%Inverse%%%%%%%%%%
Tr=0.3;
cAH1=cAH;cAH1(abs(cAH1)<Tr)=0;
cAV1=cAV;cAV1(abs(cAV1)<Tr)=0;
cAD1=cAD;cAD1(abs(cAD1)<Tr)=0;
cH1=cH;cH1(abs(cH1)<Tr)=0;
cV1=cV;cV1(abs(cV1)<Tr)=0;
cD1=cD;cD1(abs(cD1)<Tr)=0;
cAr=idwt2(cAA,cAH1,cAV1,cAD1,wavename,size(cA));
pic5=idwt2(cAr,cH1,cV1,cD1,wavename,size(pic3));
Level2=[Norm(cAA),Norm(cAH1);Norm(cAV1),Norm(cAD1)];
pic6=([Level2,Norm(cH1);Norm(cV1),Norm(cD1)]);
%%%%%%Soft Thresholding%%%%%%%
cAH2=abs(cAH1-Tr);
cAV2=abs(cAV1-Tr);
cAD2=abs(cAD1-Tr);
cH2=abs(cH1-Tr);
cV2=abs(cV1-Tr);
cD2=abs (cD1-Tr);
cAr2=idwt2(cAA,cAH2,cAV2,cAD2,wavename,size(cA));
pic7=idwt2(cAr2,cH1,cV1,cD1,wavename,size(pic3));
Level2=[Norm(cAA),Norm(cAH2);Norm(cAV2),Norm(cAD2)];
pic8=([Level2,Norm(cH2);Norm(cV2),Norm(cD2)]);

回答 (1 件)

Suraj Kumar
Suraj Kumar 2025 年 4 月 3 日
Hi Lech,
To extend your 2D wavelet denoising approach to 3D using 'dwt3' and 'idwt3', we will need to adjust the code to handle 3D data. The 'dwt3' and 'idwt3' functions in MATLAB are used for 3D discrete wavelet transforms.So to extend the approach to 3D case, we have to go through the following modifications:
1. We can create a simple 3D structure by stacking the image using the 'repmat' function. Then we can use the 'dwt3'function to perform a 3D wavelet transform which will provide us with the approximation and detailed coefficients.
volData = repmat(pic3, [1, 1, 3]);
[dec, sizes] = dwt3(volData, 'sym2', 'mode', 'per');
2. Then we can apply a threshold to the detail coefficients to suppress noise and use 'idwt3' function to reconstruct the denoised 3D volume.
Tr = 0.3;
dec.dec{2}(abs(dec.dec{2}) < Tr) = 0;
dec.dec{3}(abs(dec.dec{3}) < Tr) = 0;
dec.dec{4}(abs(dec.dec{4}) < Tr) = 0;
volDataDenoised = idwt3(dec);
imshow(volDataDenoised(:, :, 1), []);
For more information on the functions used above, please refer to the following documentation links:

カテゴリ

Help Center および File ExchangeWavelet Toolbox についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by