N=64;                     % we will be working with a 64x64 image
                        
t=[0:(N-1)]';             % column vector
et3=cos(pi*3*(t+1/2)/N);  % in R^64 (column)

s=t';                     % row vector
es3=et3';                 % in R^64 (row)

x=et3*es3;                % 64x64 basis entry for k=n=3 (Eqn13.4)

sum(sum(x.*x))            % what does this do?

% show the image x (MATLAB):
y=round((x+1)/2*255);
image(y);
colormap(gray(256));

% in OCTAVE you can do:
%y=(x+1)/2;    % then y is normalized (in [0,1])
%imshow(y,y,y) % show the image (OCTAVE)


%If you want to save it (MATLAB):
%y=uint8(y);
%imwrite(y,gray(256),'face.jpg');

% let's import a 64x64 image
[X,map]=imread('leonid.jpg','jpg');
figure(2);
image(X);


