function A = train(xyz,c)
% function that reads in the color patches in the scanner_data
% directory solves for the fitting matrix A. c is 1 or 2. If c is
% 1, 1st order model is used. Else, 2nd order\

rgb = [];
xyz = xyz(:,1:12);
for i = 1:3
  for j = 1:4
    [im,m] = imread(['scanner_data/' num2str(i) num2str(j) '.bmp']);
    [r,g,b] = getRGB(im);
    rgb = [rgb [r;g;b]];
  end
end
rgb = gammaCorrect(rgb);

if (c==1)
  A = o1fit(rgb,xyz);
else
  A = o2fit(rgb,xyz);
end

