clear all
company = {'net','ofoto','acess','fly'};
for i=1:4
   figure
   for j=1:4
      filename = [company{i} int2str(j+30)];
		im = imread(filename,'jpg');
		subplot(2,2,j);imagesc(im);
		result(i,j,1:3) = [mean(mean(im))];
   end
end

for i=1:4
	temp = squeeze(redmeanresult(i,:,:));
 	temp(:,1)=temp(:,1)/temp(1,1);temp(:,2)=temp(:,2)/temp(1,2);temp(:,3)=temp(:,3)/temp(1,3);
 	meanplot(i,:,:) = temp;
end

% this is the original mean color of the 4 pictures that we sent in
original = [153 113 113;153 113*0.75 113*0.83;153*0.75 113 113*0.83;153*0.75 113*0.7 113];

% this is the matrix that converts rgb to xyz space assuming a D65 white light
rgb2xyz = [0.5879 0.1792 0.1831; 0.2896 0.6058 0.1046; 0.0 0.06826 1.02];
white = [95 100 109];
rgb = reshape(redmeanresult,16,3);
xyz = (rgb2xyz*rgb'*100/255)';
chr = chrom(xyz');
xyzorig = (rgb2xyz*original'*100/255)';
chrorig = chrom(xyzorig');

figure
hold on
mark = ['v' '*' '.' 's' 'x'];
color=['k' 'r' 'g' 'b'];
for i=1:1:4
   plot(chrorig(1,i),chrorig(2,i),[color(i) mark(1)]);
end
for j=1:1:4
	for i=1:1:4
   plot(chr(1,(i-1)*4+j),chr(2,(i-1)*4+j),[color(i) mark(j+1)]);
	end
end

