Assembly: AForge.Imaging (in AForge.Imaging.dll) Version: 2.2.5.0 (2.2.5.0)
Syntax
C# |
---|
public class SobelEdgeDetector : BaseUsingCopyPartialFilter |
Remarks
The filter searches for objects' edges by applying Sobel operator.
Each pixel of the result image is calculated as approximated absolute gradient
magnitude for corresponding pixel of the source image:
Copy
|G| = |Gx| + |Gy] ,
Copy
Gx Gy
-1 0 +1 +1 +2 +1
-2 0 +2 0 0 0
-1 0 +1 -1 -2 -1
Copy
P1 P2 P3
P8 x P4
P7 P6 P5
|G| = |P1 + 2P2 + P3 - P7 - 2P6 - P5| +
|P3 + 2P4 + P5 - P1 - 2P8 - P7|
The filter accepts 8 bpp grayscale images for processing.
Sample usage:

// create filter SobelEdgeDetector filter = new SobelEdgeDetector( ); // apply the filter filter.ApplyInPlace( image );
Initial image:

Result image:

Inheritance Hierarchy
AForge.Imaging.Filters..::.BaseUsingCopyPartialFilter
AForge.Imaging.Filters..::.SobelEdgeDetector