%% Collect face shots of class members into a zip file living in a common/public directory

%% Download & unzip the zip file to your computer, in a place MATLAB can access like the MATLAB folder

%% Load each photo and compress it.
% Close all previous figures
	close all

% Edit PictureDir so that it contains the full location of the pictures 
	PictureDir = '~/Google Drive/Teaching/';
	%PictureDir = '~/Teaching/MA211/TestPics/';

% Search for all (JPEG) files ending with a .jpg
	Pics = dir([PictureDir,'*.jpg']);

% Resize all pictures to a common size
	r = 600; % Number of rows in new resized picture
	c = 450; % Number of cols in new resized picture

	
% Loop through each picture, load it into memory and view it
	for n=1:length(Pics)
			Im = imresize(imread([PictureDir,Pics(n).name]),[r,c]);
			PicVex(:,n) = double(reshape(Im,r*c*3,1));
			imshow(reshape(uint8(PicVex(:,n)),r,c,3))
			title(['Person ',num2str(n),],'FontSize',20);
			pause
	end
	
% Create a distance matrix of norms between each pair of pictures
% and plot the difference between two pictures
	figure; hold on;
	k = 1;
	s = length(Pics);
	for p=1:s
			for q=1:s
					DistanceMatrix(p,q) = norm(PicVex(:,p)-PicVex(:,q));
					subplot(s,s,k)
					imshow(reshape(uint8(PicVex(:,p)+PicVex(:,q)),r,c,3))
					k = k+1;
			end
	end




		

