private BitmapSource CreateWhiteNoizeBmp(int width, int height) { var dataSource = DataSource; Random rnd = new Random(); int[] pixels = new int[width * height]; for (int i = 0; i < width * height; i++) { HsbColor color = new HsbColor(0, 0, Math.Round(5 * rnd.NextDouble()) / 4); int argb = color.ToArgb(); pixels[i] = argb; } //var whiteNoizeBmp = WriteableBitmap.Create(width, height, 96, 96, PixelFormats.Pbgra32, null, pixels, width * 4); var contentBounds = dataSource.Grid.GetGridBounds(); Viewport2D.SetContentBounds(this, contentBounds); int[] effectivePixels = CreateConvolutionArray(width, height, pixels); var filter = new NormalizeFilter(); filter.Filter(effectivePixels, width, height); var result = WriteableBitmap.Create(width, height, 96, 96, PixelFormats.Pbgra32, null, effectivePixels, width * 4); //ScreenshotHelper.SaveBitmapToFile(result, "1.png"); return(result); }