function demohaar2; % % first attempt of a FAST 2dim Haar wavelet transform % ovrwriting the original matrix % working from the finest level up, replace each % 2x2 block by average in top left, and differences % along horizontal, vertical, diagonal in other 3 % this is implemented by reshape and matrixmult % then recursively consider only top left entries % of each block, and do THE SAME operation to each % % eventually want to code the inverse similarily % and to display basis elements and lin comb's % as rastered images % quality measure is energy in each frequency % and in vertical / horizontal variation and % diagonal dominance % % first attempt August 2008 n=4; N=2^n; for k=0:n-1 for i=0:2^(k+1):N-2 for j=0:2^(k+1):N-2 M=[i+1:i+2,j+1:j+2]; A=zeros(N,N) A(i+1:2^k:i+2^k+1,j+1:2^k:j+2^k+1)=10*4^k*ones(2,2) pause(0.2*2^k) end end end end