% Standard Image  (Barbara)
clear;
I1=imread('barbara.bmp');
figure(1)
imagesc(I1);colormap(gray)

I1= im2double(I1);
T = dctmtx(8);
dct = @(x)T * x * T';
B = abs(blkproc(I1,[8 8],dct));
figure(2)
imagesc(B);colormap(gray)
% AC power calc. with emphasizing high freq. components
for x=1:8:512;
    for y=1:8:512;
        B0=B(x,y);
        B(x,y)=0;
        for i=0:7;
            for j=0:7;
                B(x,y)=B(x,y)+sqrt(i^2+j^2)*B(x+i,y+j)^2;
            end;
        end;
        B(x,y)=B(x,y);
    end;
end;
% AC power padding into each block
for x=1:8:512;
    for y=1:8:512;
        for i=0:7;
            for j=0:7;
                B(x+i,y+j)=B(x,y);
            end;
        end;
    end;
end;
figure(3)
imagesc(B);colormap(gray)
