public ClusterCenter(LabXy labxy)
 {
     this.l = labxy.l;
     this.a = labxy.a;
     this.b = labxy.b;
     this.x = labxy.x;
     this.y = labxy.y;
     count  = 0;
 }
            public readonly float Distance(LabXy other, float m, float s)
            {
                float dLab = MathF.Sqrt(
                    MathF.Pow(l - other.l, 2) +
                    MathF.Pow(a - other.a, 2) +
                    MathF.Pow(b - other.b, 2));

                float dXy = MathF.Sqrt(
                    MathF.Pow(x - other.x, 2) +
                    MathF.Pow(y - other.y, 2));

                return(dLab + (m / s) * dXy);
            }
        private static LabXy[] ConvertToLabXy(ReadOnlySpan <Rgba32> pixels, int width, int height)
        {
            LabXy[] labXys = new LabXy[pixels.Length];
            //Convert pixels to LabXy
            for (int x = 0; x < width; x++)
            {
                for (int y = 0; y < height; y++)
                {
                    int i   = x + y * width;
                    var lab = new ColorLab(pixels[i]);
                    labXys[i] = new LabXy()
                    {
                        l = lab.l,
                        a = lab.a,
                        b = lab.b,
                        x = x,
                        y = y
                    };
                }
            }

            return(labXys);
        }