close all
alpha1 = 1;
alpha2 = 1/2;
lsi53 = {'p', [-0.5 -0.5], [1], [0];'u', [0.25 0.25], [0], [0]; [alpha1], [-alpha2], [], []};
lsia = {'p', [-0.75 -0.25], [0], [0];'u', [0.125 0.375], [0], [1]; [1], [1], [], []};
TT = [0.1 0.5 1 3 5 10 20 30 40];
T0 = 10;
% filename = 'barbara.pgm';
% imagedata = double(imread(filename));
barangle = 0:5:180;
for i = 1:length(barangle)
% imagedata = rotcrib(128, 128, barangle(i), 25);
imagedata = rotplane(128, 128, barangle(i));
% imagedata = smthborder(imagedata, 8);
[L H] = Lifting1D(imagedata, lsi53);
[HL HH] = Lifting1D(H', lsi53);
H = [HL, HH];
[DL DH] = DLifting(imagedata, lsia);
[DHL DHH] = DLifting(DH', lsia);
DH = [DHL, DHH];
[QDL QDH dinfo pinfo] = QDLifting_1(imagedata, lsia);
% [QDHL QDHH] = Lifting1D(QDH', lsi53);
% QDH = [QDHL, QDHH];
% for j = 1:length(TT)
Hq = Threshld(H, T0);
nnzNum1(i) = nnz(Hq)/prod(size(Hq));
DHq = Threshld(DH, T0);
nnzNum2(i) = nnz(DHq)/prod(size(DHq));
QDHq = Threshld(QDH, T0);
nnzNum3(i) = nnz(QDHq)/prod(size(QDHq));
end
figure;
 plot( barangle, nnzNum1,'--bo',barangle, nnzNum2,'-.md',barangle, nnzNum3,'-.rs');
 legend('5/3 DWT', 'Dlifting', 'QDLifting');
 xlabel('test angle');
 ylabel('proportion of non-zero coefficients in high-frequency subbands');
%   xlabel('图像边缘的角度');
%  ylabel('高频子带非零系数的比例');
 grid on
%  figure;imshow(imagedata,[])
%  title('barbara');