C# Class AForge.Imaging.Filters.CannyEdgeDetector

Canny edge detector.

The filter searches for objects' edges by applying Canny edge detector. The implementation follows Bill Green's Canny edge detection tutorial.

The implemented canny edge detector has one difference with the above linked algorithm. The difference is in hysteresis step, which is a bit simplified (getting faster as a result). On the hysteresis step each pixel is compared with two threshold values: HighThreshold and LowThreshold. If pixel's value is greater or equal to HighThreshold, then it is kept as edge pixel. If pixel's value is greater or equal to LowThreshold, then it is kept as edge pixel only if there is at least one neighbouring pixel (8 neighbours are checked) which has value greater or equal to HighThreshold; otherwise it is none edge pixel. In the case if pixel's value is less than LowThreshold, then it is marked as none edge immediately.

The filter accepts 8 bpp grayscale images for processing.

Sample usage:

// create filter CannyEdgeDetector filter = new CannyEdgeDetector( ); // apply the filter filter.ApplyInPlace( image );

Initial image:

Result image:

Inheritance: BaseUsingCopyPartialFilter
Exibir arquivo Open project: holisticware-admin/MonoVersal.AForgeNET Class Usage Examples

Public Methods

Method Description
CannyEdgeDetector ( ) : System

Initializes a new instance of the CannyEdgeDetector class.

CannyEdgeDetector ( byte lowThreshold, byte highThreshold ) : System

Initializes a new instance of the CannyEdgeDetector class.

CannyEdgeDetector ( byte lowThreshold, byte highThreshold, double sigma ) : System

Initializes a new instance of the CannyEdgeDetector class.

Protected Methods

Method Description
ProcessFilter ( UnmanagedImage source, UnmanagedImage destination, Rectangle rect ) : void

Process the filter on the specified image.

Method Details

CannyEdgeDetector() public method

Initializes a new instance of the CannyEdgeDetector class.
public CannyEdgeDetector ( ) : System
return System

CannyEdgeDetector() public method

Initializes a new instance of the CannyEdgeDetector class.
public CannyEdgeDetector ( byte lowThreshold, byte highThreshold ) : System
lowThreshold byte Low threshold.
highThreshold byte High threshold.
return System

CannyEdgeDetector() public method

Initializes a new instance of the CannyEdgeDetector class.
public CannyEdgeDetector ( byte lowThreshold, byte highThreshold, double sigma ) : System
lowThreshold byte Low threshold.
highThreshold byte High threshold.
sigma double Gaussian sigma.
return System

ProcessFilter() protected method

Process the filter on the specified image.
protected ProcessFilter ( UnmanagedImage source, UnmanagedImage destination, Rectangle rect ) : void
source UnmanagedImage Source image data.
destination UnmanagedImage Destination image data.
rect System.Drawing.Rectangle Image rectangle for processing by the filter.
return void