|
|
@ -6,7 +6,7 @@ |
|
|
namespace ImageSharp.Tests |
|
|
namespace ImageSharp.Tests |
|
|
{ |
|
|
{ |
|
|
using System.IO; |
|
|
using System.IO; |
|
|
|
|
|
using ImageSharp.PixelFormats; |
|
|
using Xunit; |
|
|
using Xunit; |
|
|
|
|
|
|
|
|
public class GaussianSharpenTest : FileTestBase |
|
|
public class GaussianSharpenTest : FileTestBase |
|
|
@ -19,19 +19,33 @@ namespace ImageSharp.Tests |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
[Theory] |
|
|
[Theory] |
|
|
[MemberData(nameof(GaussianSharpenValues))] |
|
|
[WithTestPatternImages(nameof(GaussianSharpenValues), 320, 240, PixelTypes.StandardImageClass)] |
|
|
public void ImageShouldApplyGaussianSharpenFilter(int value) |
|
|
public void ImageShouldApplyGaussianSharpenFilter<TPixel>(TestImageProvider<TPixel> provider, int value) |
|
|
|
|
|
where TPixel : struct, IPixel<TPixel> |
|
|
|
|
|
{ |
|
|
|
|
|
using (Image<TPixel> image = provider.GetImage()) |
|
|
{ |
|
|
{ |
|
|
string path = this.CreateOutputDirectory("GaussianSharpen"); |
|
|
image.GaussianSharpen(value) |
|
|
|
|
|
.DebugSave(provider, value.ToString()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
foreach (TestFile file in Files) |
|
|
[Theory] |
|
|
|
|
|
[WithTestPatternImages(nameof(GaussianSharpenValues), 320, 240, PixelTypes.StandardImageClass)] |
|
|
|
|
|
public void ImageShouldApplyGaussianSharpenFilterInBox<TPixel>(TestImageProvider<TPixel> provider, int value) |
|
|
|
|
|
where TPixel : struct, IPixel<TPixel> |
|
|
{ |
|
|
{ |
|
|
string filename = file.GetFileName(value); |
|
|
using (Image<TPixel> source = provider.GetImage()) |
|
|
using (Image image = file.CreateImage()) |
|
|
using (Image<TPixel> image = new Image<TPixel>(source)) |
|
|
using (FileStream output = File.OpenWrite($"{path}/{filename}")) |
|
|
|
|
|
{ |
|
|
{ |
|
|
image.GaussianSharpen(value).Save(output); |
|
|
Rectangle rect = new Rectangle(image.Width / 4, image.Height / 4, image.Width / 2, image.Height / 2); |
|
|
} |
|
|
image.GaussianSharpen(value, rect) |
|
|
|
|
|
.DebugSave(provider, value.ToString()); |
|
|
|
|
|
|
|
|
|
|
|
// lets draw identical shapes over the Sharpened 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); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|