%  This is a script to run all of the things needed for our
%  project.
%  Matlab eats memory, so clear everything out initially
clear all
'Loading Images'
%  Generate a random image
bigimsize = 194;
S = Generate(bigimsize);
%  Add some noise to the image to make things interesting.  We are
%  adding random noise with 10% of the power of the image.
'Adding Noise'
S = S+(.1.*(rand(size(S))-.5.*ones(size(S))));
%  Display the image
figure
imagesc(S)
colormap('gray')
axis tight
hold on
pause(.01)
'Eliminating White Space'
[W, Wmask] = WhiteSpace(Pad(S));
%  Make the mask fit over the image
Wmasknew= Wmask(17:size(S,1)+16, 17:size(S,2)+16);
%  Display the areas whitespace has isolated
figure
imagesc(S.*Wmasknew)
colormap('gray')
axis tight
hold on
pause(.01)
'Correlating'
figure
imagesc(S.*Wmasknew)
colormap('gray')
axis tight
hold on
%  Run the correlation
N=cor3(W, Wmask, Pad(S));
%  Fit the line
LineFit(N,bigimsize); 
