From ca85f1003f5539c7e1e70848d81e48772154d1dd Mon Sep 17 00:00:00 2001 From: David Rolland Date: Sat, 26 Sep 2020 20:29:10 +0900 Subject: [PATCH] Fixed typo in AdaptiveThreshold processor and added specific test --- .../Binarization/AdaptiveThresholdProcessor{TPixel}.cs | 3 ++- .../Processing/Binarization/AdaptiveThresholdTests.cs | 1 + tests/Images/External | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ImageSharp/Processing/Processors/Binarization/AdaptiveThresholdProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Binarization/AdaptiveThresholdProcessor{TPixel}.cs index 43023c938..6d95d51b3 100644 --- a/src/ImageSharp/Processing/Processors/Binarization/AdaptiveThresholdProcessor{TPixel}.cs +++ b/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; diff --git a/tests/ImageSharp.Tests/Processing/Binarization/AdaptiveThresholdTests.cs b/tests/ImageSharp.Tests/Processing/Binarization/AdaptiveThresholdTests.cs index 8efac7593..f4f800107 100644 --- a/tests/ImageSharp.Tests/Processing/Binarization/AdaptiveThresholdTests.cs +++ b/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(TestImageProvider provider) where TPixel : unmanaged, IPixel { diff --git a/tests/Images/External b/tests/Images/External index 6a0030806..28839f6ea 160000 --- a/tests/Images/External +++ b/tests/Images/External @@ -1 +1 @@ -Subproject commit 6a003080674d1fedc66292c13ce5a357b2a33083 +Subproject commit 28839f6eaa212a575005df630b6030bb4314a75b