function  A = o2fit(xyz,rgb)
% RGB values are expected to be between 0 and 1!!!
% function that calculates the transformation matrix between xyz
% and rgb: i.e. A(rgb) = xyz, where A is a 6x3 matrix. We
% transpose both sides, then use slash and transpose the result:
% i.e. (rbg)'A' = xyz', A' = rbg'\xyz';

% now we compute the 2nd order system:
rgb2 =[rgb(1,:);rgb(2,:);rgb(3,:);rgb(1,:).*rgb(2,:);rgb(2,:).*rgb(3,:);rgb(1,:).*rgb(3,:)];

A = (rgb2'\xyz')';
