Page 114 - Computational Colour Science Using MATLAB
P. 114
IMPLEMENTATIONS AND EXAMPLES 101
2
have default values of 100 cd/m . The parameter f has a default value of 1.0 and
this corresponds to typical viewing conditions (a value of 0.9 should be used for
dark or dim conditions).
Box 16: cmccat00.m
function [xyzc] = cmccat00(xyz,xyzt,xyzr,lt,lw,f)
% function [xyzc] = cmccat00(xyz,xyzt,xyzr,lt,lw,f)
% implements CMCCAT2000 chromatic adaptation transform
% operates on 1 by 3 matrix xyz containing tristimulus
% values of the stimulus under the test illuminant
% xyzt and xyzr are 1 by 3 matrices containing the
% white points for the test and reference conditions
% f has default value 1
% lt is the luminance of the adapting test field
% and has default value of 100
% lw is the luminance of the adapting reference field
% and has default value of 100
% xyzc contains the tristimulus values of the
% stimulus under the reference illuminant
% check the arguments
xyz = xyz(:); % force to be a column matrix
xyzt = xyzt(:); % force to be a column matrix
xyzr = xyzr(:); % force to be a column matrix
if (length(xyz) *=3)
disp(’first argument must be 3 by 1 or 1 by 3’); return;
end
if (length(xyzt) *=3)
disp(’second argument must be 3 by 1 or 1 by 3’); return;
end
if (length(xyzr) *=3)
disp(’third argument must be 3 by 1 or 1 by 3’); return;
end
if (nargin54)
disp(’using default values of lt, lw and f’)
lt = 100.0; lw = 100.0; f = 1.0;
end