echo on
%
%  Displays horizontal wavelet decomposition of an image.
%  We are using the magic square image which is 256x256 and has
%  been placed in the variable X and the colormap in mapX.
%
load detail
X=X(10:265,10:265);
%colormap=map;
%image(X)
makeimage(X)
pause
%
%  Now compute the Haar decomp down one level for each row.
%
pause
%A=zeros(256,256);
A=X;
count=0;
for i=1:256
   count=count+1; 
   if count==8 
       makeimage(A) 
       pause
       count=0; 
   end 
   [cA cD]=dwt(X(i,:),'haar');
   A(i,:)=[cA cD];
end
pause
%makeimage(A)
%pause;
%
%  Now calculate the Haar decomp down one level for each column
%  of A.
%
pause
B=A;
count=0;
for i=1:256
   count=count+1; 
   if count==8 
       makeimage(B) 
       pause
       count=0; 
   end 
   x=A(:,i);
   [cA cD]=dwt(x','haar');
   B(:,i)=[cA cD]';
end
%pause
%makeimage(B)
