Page 131 - Computational Colour Science Using MATLAB
P. 131
118 CHARACTERIZATION OF COMPUTER DISPLAYS
A = [r(4) g(4) b(4); r(5) g(5) b(5); r(6) g(6) b(6)];
% compute the matrix AI to convert XYZ to RGB
AI = inv(A);
% obtain the XYZ values of the neutral patches
NXYZ = N(:,4:6);
% compute the RGB values of the neutral patches
NRGB = (AI*NXYZ’)’;
% obtain the normalised dac values of the neutral patches
DRGB = N(:,1:3)/255;
% compute the GOG values for each channel
x1 = linspace(0,1,10);
x = [1, 1];
options = optimset;
x = fminsearch(’gogtest’,x,options,DRGB(:,1),NRGB(:,1));
gogvals(1,:) = x;
figure
plot(DRGB(:,1),NRGB(:,1),’r*’)
y1 = compgog(gogvals(1,:),x1);
hold on
plot(x1,y1,’r-’)
x = [1, 1];
options = optimset;
x = fminsearch(’gogtest’,x,options,DRGB(:,2),NRGB(:,2));
gogvals(2,:) = x;
hold on
plot(DRGB(:,2),NRGB(:,2),’g*’)
y1 = compgog(gogvals(2,:),x1);
hold on
plot(x1,y1,’g-’)
x = [1, 1];
options = optimset;
options.TolFun = 0.0000001;
x = fminsearch(’gogtest’,x,options,DRGB(:,3),NRGB(:,3));
gogvals(3,:) = x;
hold on