% 32500 skin samples from 17 color images will be used here to determine the
% the color distribution of a human face in chromatic color space

[cb1, cr1] = ChromaDist('skinalicia.jpg');
[cb2, cr2] = ChromaDist('skinbaby.jpg');
[cb3, cr3] = ChromaDist('skinbaby2.jpg');
[cb4, cr4] = ChromaDist('skinchinese.jpg');
[cb5, cr5] = ChromaDist('skinchinese2.jpg');
[cb6, cr6] = ChromaDist('skinjapanese.jpg');
[cb7, cr7] = ChromaDist('skincindy.jpg');
[cb8, cr8] = ChromaDist('skinblackgirl.jpg');
[cb9, cr9] = ChromaDist('skinnaomi.jpg');
[cb10, cr10] = ChromaDist('skinvivien.jpg');
[cb11, cr11] = ChromaDist('skinwhitefemale.jpg');
[cb12, cr12] = ChromaDist('skinwhitemale.jpg');
[cb13, cr13] = ChromaDist('skinwhitney.jpg');
[cb14, cr14] = ChromaDist('skinchinesegirl.jpg');
[cb15, cr15] = ChromaDist('skinwhiteboy.jpg');
[cb16, cr16] = ChromaDist('skinwhitegirl.jpg');
[cb17, cr17] = ChromaDist('skinwhitegirl2.jpg');

cb = [cb1 cb2 cb3 cb4 cb5 cb6 cb7 cb8 cb9 ... 
   	cb10 cb11 cb12 cb13 cb14 cb15 cb16 cb17];
cr = [cr1 cr2 cr3 cr4 cr5 cr6 cr7 cr8 cr9 ...
      cr10 cr11 cr12 cr13 cr14 cr15 cr16 cr17];

figure(1)
ColorDistPlot(cb,cr);

bmean = mean(cb)
rmean = mean(cr)
brcov = cov(cb,cr)

figure(2)
colorchart = zeros(256);
for b = 0:255
   for r = 0:255
		 x = [(b - bmean); (r - rmean)];
      colorchart(b+1,r+1) = exp(-0.5* x'*inv(brcov)* x);
   end
end
surf(colorchart)

