static double LabDistance(Color rgb1, Color rgb2)
        {
            Lab lab1 = new Lab(), lab2 = new Lab();

            LabConverter.ToColorSpace(new Rgb {
                R = rgb1.R, G = rgb1.G, B = rgb1.B
            }, lab1);
            LabConverter.ToColorSpace(new Rgb {
                R = rgb2.R, G = rgb2.G, B = rgb2.B
            }, lab2);
            return(Math.Pow(lab2.L - lab1.L, 2) + Math.Pow(lab2.A - lab1.A, 2) + Math.Pow(lab2.B - lab1.B, 2));
        }
Beispiel #2
0
 public override void Initialize(IRgb color)
 {
     LabConverter.ToColorSpace(color, this);
 }