public void ImageShouldApplyLomographFilterInBox <TPixel>(TestImageProvider <TPixel> provider) where TPixel : struct, IPixel <TPixel> { using (Image <TPixel> source = provider.GetImage()) using (var image = new Image <TPixel>(source)) { var bounds = new Rectangle(10, 10, image.Width / 2, image.Height / 2); image.Lomograph(bounds) .DebugSave(provider, null, Extensions.Bmp); ImageComparer.EnsureProcessorChangesAreConstrained(source, image, bounds); } }
public void ImageShouldApplyOilPaintFilterInBox <TPixel>(TestImageProvider <TPixel> provider, int levels, int brushSize) where TPixel : struct, IPixel <TPixel> { using (Image <TPixel> source = provider.GetImage()) using (var image = new Image <TPixel>(source)) { var bounds = new Rectangle(10, 10, image.Width / 2, image.Height / 2); image.OilPaint(levels, brushSize, bounds) .DebugSave(provider, string.Join("-", levels, brushSize), Extensions.Bmp); ImageComparer.EnsureProcessorChangesAreConstrained(source, image, bounds, 0.001F); } }
public void ImageShouldApplyGaussianBlurFilterInBox <TPixel>(TestImageProvider <TPixel> provider, int value) where TPixel : struct, IPixel <TPixel> { using (Image <TPixel> source = provider.GetImage()) using (Image <TPixel> image = new Image <TPixel>(source)) { Rectangle rect = new Rectangle(image.Width / 4, image.Height / 4, image.Width / 2, image.Height / 2); image.GaussianBlur(value, rect) .DebugSave(provider, value.ToString()); // lets draw identical shapes over the blured areas and ensure that it didn't change the outer area image.Fill(NamedColors <TPixel> .HotPink, rect); source.Fill(NamedColors <TPixel> .HotPink, rect); ImageComparer.CheckSimilarity(image, source); } }