Image Denoising - Bayesshrink
This function used to denoise the noisy image using Bayesoft method
%Using BAYESSHRINK
%subband dependent threshold
%Soft threshold
function [soft_X1,SOFT_PSNR
] = Bayes_soft
(X,Y
)
%One -level decomposition
[CA,CH,CV,
CD] = dwt2
(Y,
'haar');
%Call the function to calculate the threshold
CH =CH/
1.2;
CV = CV/
1.2;
CD =
CD/
1.2;
T1_CH = bayeshrink
(CD,CH
);
T1_CV = bayeshrink
(CD,CV
);
T1_CD = bayeshrink
(CD,
CD);
% Call the function to perfom soft shrinkage
de_CH = soft1
(CH,T1_CH
);
de_CV = soft1
(CV,T1_CV
);
de_CD = soft1
(CD,T1_CD
);
%Two -level decomposition
[CA1,CH1,CV1,CD1
] = dwt2
(CA,
'haar');
CH1 = CH1/
1.2;
CV1 = CV1/
1.2;
CD1 = CD1/
1.2;
%Call the function to calculate the threshold
T1_CH1 = bayeshrink
(CD1,CH1
);
T1_CV1 = bayeshrink
(CD1,CV1
);
T1_CD1 = bayeshrink
(CD1,CD1
);
% Call the function to perfom soft shrinkage
de_CH1 = soft1
(CH1,T1_CH1
);
de_CV1 = soft1
(CV1,T1_CV1
);
de_CD1 = soft1
(CD1,T1_CD1
);
%Reconstruction for soft shrinkage
X2 = idwt2
(CA1,de_CH1,de_CV1,de_CD1,
'haar');
X1 = idwt2
(X2,de_CH,de_CV,de_CD,
'haar');
SOFT_PSNR = PSNR
(X,X1
);
soft_X1 =
uint8(X1
);
Rate this code snippet:
4
Rating: 4 | Votes: 1
posted by Senthilkumar R