-
-
Notifications
You must be signed in to change notification settings - Fork 851
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Addition of Breadley AdaptiveThreshold #725
Conversation
/// </summary> | ||
public TPixel Lower { get; set; } | ||
|
||
public unsafe void Apply(Image<TPixel> source, Rectangle sourceRectangle) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why unsafe
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh! forgot to remove that, was doing some experimenting but since there are 2DArray pool I didn't implement it. Will remove it asap.
src/ImageSharp/Processing/Processors/Binarization/AdaptiveThresholdProcessor.cs
Outdated
Show resolved
Hide resolved
# Inherited from ImageProcessor # Minor changes to variables # Minor Tweaks
Codecov Report
@@ Coverage Diff @@
## master #725 +/- ##
==========================================
+ Coverage 82.32% 82.37% +0.05%
==========================================
Files 681 684 +3
Lines 29438 29522 +84
Branches 3325 3330 +5
==========================================
+ Hits 24234 24318 +84
Misses 4515 4515
Partials 689 689
Continue to review full report at Codecov.
|
One question does arise from the attempt to implement Parallelism into this algorithm: |
Haven't forgotten about this. Will get it merged eventually! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of questions on stuff I don't understand.
src/ImageSharp/Processing/Processors/Binarization/AdaptiveThresholdProcessor.cs
Outdated
Show resolved
Hide resolved
src/ImageSharp/Processing/Processors/Binarization/AdaptiveThresholdProcessor.cs
Outdated
Show resolved
Hide resolved
src/ImageSharp/Processing/Processors/Binarization/AdaptiveThresholdProcessor.cs
Outdated
Show resolved
Hide resolved
src/ImageSharp/Processing/Processors/Binarization/AdaptiveThresholdProcessor.cs
Outdated
Show resolved
Hide resolved
@SimantoR This is next on my todo list for review and will helping you finish it off. |
Any update on this? Would really like to use it in a project I've got going on. |
@zmmille2 |
Yeah @brianpopow that would be great! |
src/ImageSharp/Processing/Processors/Binarization/AdaptiveThresholdProcessor{TPixel}.cs
Outdated
Show resolved
Hide resolved
src/ImageSharp/Processing/Processors/Binarization/AdaptiveThresholdProcessor{TPixel}.cs
Outdated
Show resolved
Hide resolved
TPixel pixel = pixelRow[x]; | ||
pixel.ToRgba32(ref rgb); | ||
|
||
var x1 = (ushort)Math.Max(x - this.startX - this.clusterSize + 1, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This cast limits our range. If x
or y
are greater than ushort.MaxValue
we end up with the wrong offset.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
somehow i managed to miss that
src/ImageSharp/Processing/Processors/Binarization/AdaptiveThresholdProcessor{TPixel}.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Thanks for finishing this off 👍
That's great to see. I just saw the activity on this PR. I'm so glad this got finished! |
Adaptive Threshold
Description
Added Bradley Adaptive Threshold, tweaked from the original published paper by Derek Bradley of Carleton University and Gerhard Roth of National Research Council of Canada. It has been tested on the sample document used in the paper.TODO