コード例 #1
0
        /// <summary>
        /// Updates the centroid to the mean of all pixel rgb vectors stored inside
        /// </summary>
        public bool UpdateCentroid()
        {
            if (Pixels.Count == 0)
            {
                return(false);
            }

            var oldCentroid = ColorCentroid;

            ColorCentroid = RgbVector.Mean((from pixel in Pixels select pixel.ColorRgb).ToArray());

            return(oldCentroid.Equals(ColorCentroid));
        }
コード例 #2
0
 public ImagePixel(int x, int y, Color color)
 {
     this.Position = new Vector2 <int>(x, y);
     this.ColorRgb = new RgbVector(color.R, color.G, color.B);
 }