Page 81 - Computational Colour Science Using MATLAB
P. 81

68                COMPUTING COLOUR DIFFERENCE

                 else
                   disp(’ch must be a row matrix’);
                   return;
                 end
                 if (dim(2) *=2)
                   disp(’ch must be 2 by 1 or 1 by 2’);
                   return;
                 end

                 C = ch(1);
                 H = ch(2);

                 fx = tan(H*pi/180);

                 a = sqrt(C*C/(1 + fx*fx));

                 b = a*fx;

                 if (H < 90.0)
                   % first quadrant
                   a = abs(a);
                   b = abs(b);
                 elseif (H < 180)
                   % second quadrant
                   a = -abs(a);
                   b = abs(b);
                 elseif (H < 270)
                   % third quadrant
                   a = -abs(a);
                   b = -abs(b);
                 else
                   % fourth quadrant
                   a = abs(a);
                   b = -abs(b);
                 end






               5.5.2 Computing colour difference

               The function cielabde computes the CIELAB colour difference [Equation (5.10)]
               from two L*, a*, b* triplets. This function also returns the component deltas,
   76   77   78   79   80   81   82   83   84   85   86