C# Класс 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:

Наследование: BaseUsingCopyPartialFilter
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Защищенные методы

Метод Описание
ProcessFilter ( UnmanagedImage source, UnmanagedImage destination, Rectangle rect ) : void

Process the filter on the specified image.

Описание методов

CannyEdgeDetector() публичный Метод

Initializes a new instance of the CannyEdgeDetector class.
public CannyEdgeDetector ( ) : System
Результат System

CannyEdgeDetector() публичный Метод

Initializes a new instance of the CannyEdgeDetector class.
public CannyEdgeDetector ( byte lowThreshold, byte highThreshold ) : System
lowThreshold byte Low threshold.
highThreshold byte High threshold.
Результат System

CannyEdgeDetector() публичный Метод

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.
Результат System

ProcessFilter() защищенный Метод

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.
Результат void