Code

Image denoising - Oracleshrink method

Senthilkumar July 30, 20111 comment Coded in Matlab

This function used to denoise a noisy image using oraclesoft method

%Using oracle threshold alone
%subband dependent threshold
%Soft and Hard threshold

function [soft_X1,SOFT_PSNR]  = Oracle_soft(X,Y)
%One -level decomposition
[CA,CH,CV,CD] = dwt2(Y,'haar');
[ca,ch,cv,cd] = dwt2(X,'haar');
%Call the function to calculate the threshold
T_CH  = func_threshold(CH);
T1_CH = oracleshrink1(ca,T_CH);
T_CV  = func_threshold(CV);
T1_CV = oracleshrink1(cv,T_CV);
T_CD  = func_threshold(CD);
T1_CD = oracleshrink1(cd,T_CD);
HH = uint8(T1_CD);
HL = uint8(T1_CV);
LH = uint8(T1_CH);
% 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');
[ca1,ch1,cv1,cd1] = dwt2(ca,'haar');
%Call the function to calculate the threshold
T_CH1  = func_threshold(CH1);
T1_CH1 = oracleshrink1(ch1,T_CH1);
T_CV1  = func_threshold(CV1);
T1_CV1 = oracleshrink1(cv1,T_CV1);
T_CD1  = func_threshold(CD1);
T1_CD1 = oracleshrink1(cd1,T_CD1);
HH1 = uint8(T1_CD1);
HL1 = uint8(T1_CV1);
LH1 = uint8(T1_CH1);
% 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);