function[dollar5,dollar10,dollar20,dollar50,dollar100,d5deg1,d10deg1,d20deg1,d50deg1,d100deg1,d5deg2,d10deg2,d20deg2,d50deg2,d100deg2,d5deg3,d10deg3,d20deg3,d50deg3,d100deg3,d5deg4,d10deg4,d20deg4,d50deg4,d100deg4,d5deg5,d10deg5,d20deg5,d50deg5,d100deg5,d5deg6,d10deg6,d20deg6,d50deg6,d100deg6,d5deg7,d10deg7,d20deg7,d50deg7,d100deg7,d5deg8,d10deg8,d20deg8,d50deg8,d100deg8,d5deg9,d10deg9,d20deg9,d50deg9,d100deg9,d5deg10,d10deg10,d20deg10,d50deg10,d100deg10] = fftemplates()
% This function performs the FFT for all the templates. The outputs of the
% program are:
% dollar5 to dollar100 is for 0 degree of rotation
% d5deg1 to d100deg1 is for 1 degree rotation
% d5deg2 to d100deg2 is for 2 degree rotation
% d5deg3 to d100deg3 is for 3 degree rotation
% d5deg4 to d100deg4 is for 4 degree rotation
% d5deg5 to d100deg5 is for 5 degree rotation
% d5deg6 to d100deg6 is for 6 degree rotation
% d5deg7 to d100deg7 is for 7 degree rotation
% d5deg8 to d100deg8 is for 8 degree rotation
% d5deg9 to d100deg9 is for 9 degree rotation
% d5deg10 to d100deg10 is for 10 degree rotation


% [dollar5 dollar10 dollar20 dollar50 dollar100 d5deg1 d10deg1 d20deg1 d50deg1 d100deg1 d5deg2 d10deg2 d20deg2 d50deg2 d100deg2 d5deg3 d10deg3 d20deg3 d50deg3 d100deg3 d5deg4 d10deg4 d20deg4 d50deg4 d100deg4 d5deg5 d10deg5 d20deg5 d50deg5 d100deg5 d5deg6 d10deg6 d20deg6 d50deg6 d100deg6 d5deg7 d10deg7 d20deg7 d50deg7 d100deg7 d5deg8 d10deg8 d20deg8 d50deg8 d100deg8 d5deg9 d10deg9 d20deg9 d50deg9 d100deg9 d5deg10 d10deg10 d20deg10 d50deg10 d100deg10] = fftemplates;

% Reading in all the images and performing the treshold function on it
I = imread('5_1.bmp');
I1 = imread('10.bmp');
I2 = imread('20.bmp');
I3 = imread('50.bmp');
I4 = imread('100.bmp');
bw = tresh(0.85,I);
bw1 = tresh(0.85,I1);
bw2 = tresh(0.85,I2);
bw3 = tresh(0.85,I3);
bw4 = tresh(0.85,I4);

% Performing the FFT on the $5 - $100 with 0 degree of rotation
[dollar5 dollar10 dollar20 dollar50 dollar100] = ffttemp(bw,bw1,bw2,bw3,bw4);


% Performing the FFT on the $5 - $100 with 1 degree of rotation
y = skewtemplates(bw,1,1);     
y1 = skewtemplates(bw1,1,1);
y2 = skewtemplates(bw2,1,1);
y3 = skewtemplates(bw3,1,1);
y4 = skewtemplates(bw4,1,1);

[d5deg1 d10deg1 d20deg1 d50deg1 d100deg1] =ffttemp(y,y1,y2,y3,y4);


% Performing the FFT on the $5 - $100 with 2 degree of rotation
y = skewtemplates(bw,2,1);     
y1 = skewtemplates(bw1,2,1);
y2 = skewtemplates(bw2,2,1);
y3 = skewtemplates(bw3,2,1);
y4 = skewtemplates(bw4,2,1);

[d5deg2 d10deg2 d20deg2 d50deg2 d100deg2] =ffttemp(y,y1,y2,y3,y4);


% Performing the FFT on the $5 - $100 with 3 degree of rotation
y = skewtemplates(bw,3,1);     
y1 = skewtemplates(bw1,3,1);
y2 = skewtemplates(bw2,3,1);
y3 = skewtemplates(bw3,3,1);
y4 = skewtemplates(bw4,3,1);

[d5deg3 d10deg3 d20deg3 d50deg3 d100deg3] =ffttemp(y,y1,y2,y3,y4);


% Performing the FFT on the $5 - $100 with 4 degree of rotation
y = skewtemplates(bw,4,1);     
y1 = skewtemplates(bw1,4,1);
y2 = skewtemplates(bw2,4,1);
y3 = skewtemplates(bw3,4,1);
y4 = skewtemplates(bw4,4,1);

[d5deg4 d10deg4 d20deg4 d50deg4 d100deg4] =ffttemp(y,y1,y2,y3,y4);


% Performing the FFT on the $5 - $100 with 5 degree of rotation
y = skewtemplates(bw,5,1);     
y1 = skewtemplates(bw1,5,1);
y2 = skewtemplates(bw2,5,1);
y3 = skewtemplates(bw3,5,1);
y4 = skewtemplates(bw4,5,1);

[d5deg5 d10deg5 d20deg5 d50deg5 d100deg5] =ffttemp(y,y1,y2,y3,y4);


% Performing the FFT on the $5 - $100 with 6 degree of rotation
y = skewtemplates(bw,6,1);     
y1 = skewtemplates(bw1,6,1);
y2 = skewtemplates(bw2,6,1);
y3 = skewtemplates(bw3,6,1);
y4 = skewtemplates(bw4,6,1);

[d5deg6 d10deg6 d20deg6 d50deg6 d100deg6] =ffttemp(y,y1,y2,y3,y4);


% Performing the FFT on the $5 - $100 with 7 degree of rotation
y = skewtemplates(bw,7,1);     
y1 = skewtemplates(bw1,7,1);
y2 = skewtemplates(bw2,7,1);
y3 = skewtemplates(bw3,7,1);
y4 = skewtemplates(bw4,7,1);

[d5deg7 d10deg7 d20deg7 d50deg7 d100deg7] =ffttemp(y,y1,y2,y3,y4);


% Performing the FFT on the $5 - $100 with 8 degree of rotation
y = skewtemplates(bw,8,1);     
y1 = skewtemplates(bw1,8,1);
y2 = skewtemplates(bw2,8,1);
y3 = skewtemplates(bw3,8,1);
y4 = skewtemplates(bw4,8,1);

[d5deg8 d10deg8 d20deg8 d50deg8 d100deg8] =ffttemp(y,y1,y2,y3,y4);


% Performing the FFT on the $5 - $100 with 9 degree of rotation
y = skewtemplates(bw,9,1);     
y1 = skewtemplates(bw1,9,1);
y2 = skewtemplates(bw2,9,1);
y3 = skewtemplates(bw3,9,1);
y4 = skewtemplates(bw4,9,1);

[d5deg9 d10deg9 d20deg9 d50deg9 d100deg9] =ffttemp(y,y1,y2,y3,y4);


% Performing the FFT on the $5 - $100 with 10 degree of rotation
y = skewtemplates(bw,10,1);     
y1 = skewtemplates(bw1,10,1);
y2 = skewtemplates(bw2,10,1);
y3 = skewtemplates(bw3,10,1);
y4 = skewtemplates(bw4,10,1);

[d5deg10 d10deg10 d20deg10 d50deg10 d100deg10] =ffttemp(y,y1,y2,y3,y4);


% Note to increase the degree of rotation or to include the anticlockwise
% direction, just repeat the skewtemplates with different values.