예제 #1
0
 public static Bitmap DetectEdges(Bitmap original, ExchangeMask maskType)
 {
     var mask = masks[(int)maskType];
     var current = new Bitmap(original.Width, original.Height);
     var gsBytes = original.GetGrayscaleBytes();
     for (var i = 0; i < current.Width; i++)
         for (var j = 0; j < current.Height; j++) {
             var newVal = GetSiblings(gsBytes, i, j)
                 .Zip(mask, (a, b) => a * b)
                 .Sum();
             newVal = (newVal > limit) ? 255 : 0;
             current.SetPixel(i, j, Color.FromArgb(255, newVal, newVal, newVal));
         }
     return current;
 }
예제 #2
0
 public static Bitmap DetectEdges(this Bitmap image, ExchangeMask maskType)
 {
     return EdgeDetection.DetectEdges(image, maskType);
 }