- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 888
Better Edge Detection API #1299
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
Conversation
| Codecov Report
 @@            Coverage Diff             @@
##           master    #1299      +/-   ##
==========================================
+ Coverage   82.70%   82.71%   +0.01%     
==========================================
  Files         697      692       -5     
  Lines       30677    30718      +41     
  Branches     3470     3474       +4     
==========================================
+ Hits        25370    25409      +39     
+ Misses       4604     4603       -1     
- Partials      703      706       +3     
 Flags with carried forward coverage won't be shown. Click here to find out more. 
 Continue to review full report at Codecov. 
 | 
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.
I tested this for the scenario brought up in discussion #1297
This new API makes it extremely easy to do custom edge processing.
| Perfect @dalingrin I’m glad I was able to improve matters. | 
| @SixLabors/core I'm going to merge this unless anyone objects. I'm very happy with it. | 
Prerequisites
Description
As discussed in #1297 It's not currently possible to implement your own custom edge detection kernels.
This goes against the nature of the API and as such I deem it necessary to refactor the API to allow extensibility. This is a breaking change.
The API has been refactored to expose three structs representing three types of edge detection kernels.
EdgeDetectorKernelContains a single 2D XY kernel.EdgeDetector2DKernelContains two separable 1D kernels.EdgeDetectorCompassKernelContains eight kernels representing each point on the compass.A new static class
KnownEdgeDetectorKernelsreplaces the current enumEdgeDetectionOperators.Individual edge detection processors
SobelProcessoretc have been replaced with versions representing each of the three kernel types.The resulting code is much simpler and more powerful allowing users to implement any series of gradient operators they require.