コード例 #1
0
 public static IEnumerable <AvailableImage> ReadAvailableImages(string sourceDir, int targetBlockSize)
 {
     foreach (var imageFile in Directory.EnumerateFiles(sourceDir, "*.jpg", SearchOption.AllDirectories))
     {
         Console.WriteLine("Reading " + imageFile);
         AvailableImage availableImage = null;
         try
         {
             availableImage = new AvailableImage(targetBlockSize, MakeGrayscale3(new Bitmap(imageFile)));
         }
         catch (Exception e)
         {
             Console.WriteLine(e);
         }
         if (availableImage != null)
         {
             yield return(availableImage);
         }
     }
 }
コード例 #2
0
 public TargetPixelGenerator(AvailableImage availableImage, SourcePixelBlock sourcePixelBlock)
 {
     _availableImage   = availableImage;
     _sourcePixelBlock = sourcePixelBlock;
 }
コード例 #3
0
 public int CompareColors(AvailableImage a)
 {
     return(Math.Abs(a.AverageColor.R - _originalAverageColor.R) + Math.Abs(a.AverageColor.G - _originalAverageColor.G) + Math.Abs(a.AverageColor.B - _originalAverageColor.B));
 }