load hw7image.mat bx = 8; by = 8; [sx sy] = size(hw7image); nbx = floor(sx/bx); nby = floor(sy/by); % vectorize image 64 x nblocks vectors hodct = zeros([bx*by nbx*nby]); hohad = zeros([bx*by nbx*nby]); hohar = zeros([bx*by nbx*nby]); % build hadamard and haar tranform matrices % loop through 8x8 blocks for lp1 = 1:nbx for lp2 = 1:nby nn = lp2 + (lp1-1)*nby; subim = ho(lp1*bx-7:lp1*bx,lp2*by-7:lp2*by); % do DCT transform here subimt = subim; % place holder hodct(:,nn) = subimt(:); % do hadamard transform subimt = subim; % place holder hohad(:,nn) = subimt(:); % do haar transform subimt = subim; % place holder hohar(:,nn) = subimt(:); end end % find variances along rows of hodct, hohad, hohar % plot variances and cumulative variances % determine number of bits for each coeff