|
|
@ -17,7 +17,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Normalization |
|
|
[Theory] |
|
|
[Theory] |
|
|
[InlineData(256)] |
|
|
[InlineData(256)] |
|
|
[InlineData(65536)] |
|
|
[InlineData(65536)] |
|
|
public void HistogramEqualizationTest(int luminanceLevels) |
|
|
public void GlobalHistogramEqualization_WithDifferentLumanceLevels(int luminanceLevels) |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var pixels = new byte[] |
|
|
var pixels = new byte[] |
|
|
@ -58,7 +58,8 @@ namespace SixLabors.ImageSharp.Tests.Processing.Normalization |
|
|
// Act
|
|
|
// Act
|
|
|
image.Mutate(x => x.HistogramEqualization(new HistogramEqualizationOptions |
|
|
image.Mutate(x => x.HistogramEqualization(new HistogramEqualizationOptions |
|
|
{ |
|
|
{ |
|
|
LuminanceLevels = luminanceLevels |
|
|
LuminanceLevels = luminanceLevels, |
|
|
|
|
|
Method = HistogramEqualizationMethod.Global |
|
|
})); |
|
|
})); |
|
|
|
|
|
|
|
|
// Assert
|
|
|
// Assert
|
|
|
@ -75,6 +76,24 @@ namespace SixLabors.ImageSharp.Tests.Processing.Normalization |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[Theory] |
|
|
|
|
|
[WithFile(TestImages.Jpeg.Baseline.HistogramEqImage, PixelTypes.Rgba32)] |
|
|
|
|
|
public void GlobalHistogramEqualization_CompareToReferenceOutput<TPixel>(TestImageProvider<TPixel> provider) |
|
|
|
|
|
where TPixel : unmanaged, IPixel<TPixel> |
|
|
|
|
|
{ |
|
|
|
|
|
using (Image<TPixel> image = provider.GetImage()) |
|
|
|
|
|
{ |
|
|
|
|
|
var options = new HistogramEqualizationOptions |
|
|
|
|
|
{ |
|
|
|
|
|
Method = HistogramEqualizationMethod.Global, |
|
|
|
|
|
LuminanceLevels = 256, |
|
|
|
|
|
}; |
|
|
|
|
|
image.Mutate(x => x.HistogramEqualization(options)); |
|
|
|
|
|
image.DebugSave(provider); |
|
|
|
|
|
image.CompareToReferenceOutput(ValidatorComparer, provider, extension: "png"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
[Theory] |
|
|
[Theory] |
|
|
[WithFile(TestImages.Jpeg.Baseline.LowContrast, PixelTypes.Rgba32)] |
|
|
[WithFile(TestImages.Jpeg.Baseline.LowContrast, PixelTypes.Rgba32)] |
|
|
public void Adaptive_SlidingWindow_15Tiles_WithClipping<TPixel>(TestImageProvider<TPixel> provider) |
|
|
public void Adaptive_SlidingWindow_15Tiles_WithClipping<TPixel>(TestImageProvider<TPixel> provider) |
|
|
|