Exemplo n.º 1
0
        public static double XYZtoDelta(cXYZ c1, cXYZ c2)
        {
            cLAB lab1 = XYZtoLAB(c1);
            cLAB lab2 = XYZtoLAB(c2);

            return(LABtoDelta(lab1, lab2));
        }
Exemplo n.º 2
0
        public static double RGBtoDelta(Color c1, Color c2)
        {
            cLAB lab1 = RGBtoLAB(c1);
            cLAB lab2 = RGBtoLAB(c2);

            return(LABtoDelta(lab1, lab2));
        }
Exemplo n.º 3
0
        public static Color LABtoRGB(cLAB LAB)
        {
            cXYZ  xyz = LABtoXYZ(LAB);
            Color rgb = XYZtoRGB(xyz);

            return(rgb);
        }
Exemplo n.º 4
0
        public static cLAB RGBtoLAB(Color rgb)
        {
            cXYZ xyz = RGBtoXYZ(rgb.R, rgb.G, rgb.B);
            cLAB lab = XYZtoLAB(xyz);

            return(lab);
        }
Exemplo n.º 5
0
        public static cLAB RGBtoLAB(int r, int g, int b)
        {
            cXYZ xyz = RGBtoXYZ(r, g, b);
            cLAB lab = XYZtoLAB(xyz);

            return(lab);
        }
Exemplo n.º 6
0
        public static double LABtoDelta(cLAB c1, cLAB c2)
        {
            try
            {
                double _L = Math.Pow(c1.L - c2.L, 2);
                double _a = Math.Pow(c1.a - c2.a, 2);
                double _b = Math.Pow(c1.b - c2.b, 2);

                double Delta = Math.Sqrt(_L + _a + _b);

                return(Delta);
            }
            catch
            {
                return(0);
            }
        }
Exemplo n.º 7
0
        public static cLAB XYZtoLAB(double X, double Y, double Z)
        {
            double _X = X / 95.047d;
            double _Y = Y / 100d;
            double _Z = Z / 108.883d;

            _X = _X > 0.008856d ? Math.Pow(_X, (1d / 3d)) : (7.787d * _X) + (16d / 116d);
            _Y = _Y > 0.008856d ? Math.Pow(_Y, (1d / 3d)) : (7.787d * _Y) + (16d / 116d);
            _Z = _Z > 0.008856d ? Math.Pow(_Z, (1d / 3d)) : (7.787d * _Z) + (16d / 116d);

            cLAB lab = new cLAB();

            lab.L = (116d * _Y) - 16d; // helderheid 0-100
            lab.a = 500d * (_X - _Y);  // groen-rood -127 - 127
            lab.b = 200d * (_Y - _Z);  // blauw-geel -127 - 127

            return(lab);
        }
Exemplo n.º 8
0
        public static cXYZ LABtoXYZ(cLAB LAB)
        {
            cXYZ xyz = LABtoXYZ(LAB.L, LAB.a, LAB.b);

            return(xyz);
        }
Exemplo n.º 9
0
        public static cLAB XYZtoLAB(cXYZ XYZ)
        {
            cLAB lab = XYZtoLAB(XYZ.X, XYZ.Y, XYZ.Z);

            return(lab);
        }