/// <summary> /// Creates a new filtered WriteableBitmap. /// </summary> /// <param name="bmp">The WriteableBitmap.</param> /// <param name="kernel">The kernel used for convolution.</param> /// <returns>A new WriteableBitmap that is a filtered version of the input.</returns> public static BitmapBuffer Convolute(this BitmapBuffer bmp, int[,] kernel) { int kernelFactorSum = 0; foreach (int b in kernel) { kernelFactorSum += b; } return(bmp.Convolute(kernel, kernelFactorSum, 0)); }