Page 89 - Computational Colour Science Using MATLAB
P. 89

76                COMPUTING COLOUR DIFFERENCE



                 % function [de,dl,dc,dh] = cie00de(lab1,lab2,paral,
                 % parac,parah)
                 % computes colour difference from CIELAB values
                 % using the CIEDE2000 formula
                 % lab1 and lab2 must be 3 by 1 or 1 by 3 matrices
                 % and contain L*, a* and b* values
                 % The dl, dc and dh components are CIEDE2000 deltas
                 % The defaults for paral, parac and parah are 1
                 % see also cielabde, cmcde, and cie94de

                 dim = size(lab1);
                 if (dim(1) == 1) | (dim(2) == 1)
                   lab1 = lab1(:)’; % force to be a row matrix
                 else
                   disp(’lab1 must be a row matrix’);
                   return;
                 end
                 if (dim(2) *=3)
                   disp(’lab1 must be 3 by 1 or 1 by 3’);
                   return;
                 end

                 dim = size(lab2);
                 if (dim(1) == 1) | (dim(2) == 1)
                   lab2 = lab2(:)’; % force to be a row matrix
                 else
                   disp(’lab2 must be a row matrix’);
                   return;
                 end


                 if (dim(2) *=3)
                   disp(’lab2 must be 3 by 1 or 1 by 3’);
                   return;
                 end


                 if (nargin<5)
                   disp(’using default values of parametric values’)
                   paral=1; parac=1; parah = 1;
                 end


                 % convert the cartesian a*b* to polar chroma and hue
   84   85   86   87   88   89   90   91   92   93   94