www.pudn.com > m_program.zip > dbrec2.m


function x=dbdec2(a,h,v,d,N) 
%dbdec2  2-D Daubchies reconstruct  
%x=dbdec2(a,h,v,d,N) 
 
sx=size(a); 
ca1=a; 
ch1=h; 
cv1=v; 
cd1=d; 
 
%calculate the db filter 
rhcoef=dbaux(N); 
rgcoef=rh2rg(rhcoef); 
lrhcoef=length(rhcoef); 
 
%db  reconstruct 
lcout=lrhcoef+(sx(2)-N+1)*2-1; 
lrout=lrhcoef+(sx(1)-N+1)*2-1; 
 
%db  reconstruct 
ca1=wconv('col',dyadup(ca1,'row',1),rhcoef); 
ca1=wconv('row',dyadup(ca1,'col',1),rhcoef); 
ca=ca1(lrhcoef:lrout,lrhcoef:lcout)*2; 
ch1=wconv('col',dyadup(ch1,'row',1),rgcoef); 
ch1=wconv('row',dyadup(ch1,'col',1),rhcoef); 
ch=ch1(lrhcoef:lrout,lrhcoef:lcout)*2; 
cv1=wconv('col',dyadup(cv1,'row',1),rhcoef); 
cv1=wconv('row',dyadup(cv1,'col',1),rgcoef); 
cv=cv1(lrhcoef:lrout,lrhcoef:lcout)*2; 
cd1=wconv('col',dyadup(cd1,'row',1),rgcoef); 
cd1=wconv('row',dyadup(cd1,'col',1),rgcoef); 
cd=cd1(lrhcoef:lrout,lrhcoef:lcout)*2; 
 
x=ca+ch+cv+cd; 
 
%-----------------------------------------------------% 
% Internal Function(s) 
%-----------------------------------------------------% 
function rg=rh2rg(rh) 
%rh2rg   Calculate the db filter coef  
 
for i=1:length(rh) 
    rg(i)=-(-1)^i*rh(length(rh)-i+1); 
end