Page 86 - Computational Colour Science Using MATLAB
P. 86

IMPLEMENTATIONS AND EXAMPLES                       73

                dc^2);

                % get the polarity of the dh term
                dh = dh*dhpolarity(lab1,lab2);

                % now compute the CMC weights
                if (lab1(1)<16)
                  Lweight = 0.511;
                else
                  Lweight = (0.040975*lab1(1))/(1 + 0.01765*lab1(1));
                end
                [c,h] = car2pol([lab1(2) lab1(3)]);
                % require C*ab and H*ab of standard
                Cweight = 0.638 + (0.0638*c)/(1 + 0.0131*c);
                if (164 < h& h < 345)
                  k1 = 0.56; k2 = 0.20; k3 = 168;
                else
                  k1 = 0.36; k2 = 0.40; k3 = 35;
                end
                T = k1 + abs(k2*cos((h + k3)*pi/180));

                F = sqrt((c^4)/(c^4 + 1900));
                Hweight = Cweight*(T*F + 1 - F);

                dl = dl/(Lweight*paral);
                dc = dc/(Cweight*parac);
                dh = dh/Hweight;


                de = sqrt(dl^2 + dc^2 + dh^2);



               The function cie94de computes the CIE94 equation and operates in a similar
             manner to cielabde and cmcde with the following format:

                  [de, dl, dc, dh] = cie94de(lab1, lab2)



                Box 13: cie94de.m


                function [de,dl,dc,dh] = cie94de(lab1,lab2)

                % function [de,dl,dc,dh] = cie94de(lab1,lab2)
   81   82   83   84   85   86   87   88   89   90   91