Browse Source

Fixed typo in AdaptiveThreshold processor and added specific test

js/color-alpha-handling
David Rolland 5 years ago
parent
commit
ca85f1003f
  1. 3
      src/ImageSharp/Processing/Processors/Binarization/AdaptiveThresholdProcessor{TPixel}.cs
  2. 1
      tests/ImageSharp.Tests/Processing/Binarization/AdaptiveThresholdTests.cs
  3. 2
      tests/Images/External

3
src/ImageSharp/Processing/Processors/Binarization/AdaptiveThresholdProcessor{TPixel}.cs

@ -67,7 +67,8 @@ namespace SixLabors.ImageSharp.Processing.Processors.Binarization
ref TPixel color = ref Unsafe.Add(ref rowRef, x);
color.ToRgba32(ref rgb);
sum += (ulong)(rgb.R + rgb.G + rgb.G);
sum += (ulong)(rgb.R + rgb.G + rgb.B);
if (x - startX != 0)
{
intImage[x - startX, y - startY] = intImage[x - startX - 1, y - startY] + sum;

1
tests/ImageSharp.Tests/Processing/Binarization/AdaptiveThresholdTests.cs

@ -100,6 +100,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Binarization
[Theory]
[WithFile(TestImages.Png.Bradley01, PixelTypes.Rgba32)]
[WithFile(TestImages.Png.Bradley02, PixelTypes.Rgba32)]
[WithFile(TestImages.Png.Ducky, PixelTypes.Rgba32)]
public void AdaptiveThreshold_Works<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel>
{

2
tests/Images/External

@ -1 +1 @@
Subproject commit 6a003080674d1fedc66292c13ce5a357b2a33083
Subproject commit 28839f6eaa212a575005df630b6030bb4314a75b
Loading…
Cancel
Save