Skip to content

Commit ee30c71

Browse files
authored
Merge pull request #1362 from rold2007/master
Fixed typo in AdaptiveThreshold
2 parents b06cb32 + 856d8af commit ee30c71

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ protected override void OnFrameApply(ImageFrame<TPixel> source)
6767
ref TPixel color = ref Unsafe.Add(ref rowRef, x);
6868
color.ToRgba32(ref rgb);
6969

70-
sum += (ulong)(rgb.R + rgb.G + rgb.G);
70+
sum += (ulong)(rgb.R + rgb.G + rgb.B);
71+
7172
if (x - startX != 0)
7273
{
7374
intImage[x - startX, y - startY] = intImage[x - startX - 1, y - startY] + sum;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ public void AdaptiveThreshold_SettingUpperLowerWithThresholdLimit_WithRectangle_
100100
[Theory]
101101
[WithFile(TestImages.Png.Bradley01, PixelTypes.Rgba32)]
102102
[WithFile(TestImages.Png.Bradley02, PixelTypes.Rgba32)]
103+
[WithFile(TestImages.Png.Ducky, PixelTypes.Rgba32)]
103104
public void AdaptiveThreshold_Works<TPixel>(TestImageProvider<TPixel> provider)
104105
where TPixel : unmanaged, IPixel<TPixel>
105106
{

0 commit comments

Comments
 (0)