Example #1
0
        /// <summary>
        ///     This method will iterate through all the regions and grab the average of each deltaE value
        ///     over all pixels in all regions.
        /// </summary>
        public double CalculateAccuracy()
        {
            var imageComparer  = new ImageComparer();
            var originalBitmap = ReadonlyBitmap.Get();
            var lines          = OutputLines(originalBitmap.Width, originalBitmap.Height);
            var allDeltaEList  = new List <double>();

            foreach (var site in Sites)
            {
                allDeltaEList.AddRange(imageComparer.CalculateRegionsDeltaEList(originalBitmap, OutputRegion(site, lines), new IntPoint2D(site)));
            }
            return(allDeltaEList.Average());
        }
Example #2
0
 /// <summary>
 ///     Takes the VoronoiOuput and fills in the Bitmap accordingly
 /// </summary>
 /// <param name="voronoi">output to be drawn</param>
 public void DrawVoronoi(VoronoiOutput voronoi)
 {
     if (ReadonlyBitmap.Get() == null)
     {
         throw new IOException();
     }
     foreach (var site in voronoi.Sites)
     {
         var lines          = voronoi.OutputLines(_bitmap.Width, _bitmap.Height);
         var intPoint2DList = voronoi.OutputRegion(site, lines);
         var regionColor    = ReadonlyBitmap.Get().GetPixel((int)site.X, (int)site.Y);
         foreach (var point in intPoint2DList)
         {
             _bitmap.SetPixel(point.X, point.Y, regionColor);
         }
     }
 }