Class CannyEdgeDetector
Canny edge detector.
Inherited Members
Namespace: AForge.Imaging.Filters
Assembly: TowseyLibrary.dll
Syntax
public class CannyEdgeDetector : BaseUsingCopyPartialFilter
Remarks
The filter searches for objects' edges by applying Canny edge detector. The implementation follows Bill Green's Canny edge detection tutorial.
note
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: High
The filter accepts 8 bpp grayscale images for processing.
Sample usage:
// create filter
CannyEdgeDetector filter = new CannyEdgeDetector( );
// apply the filter
filter.ApplyInPlace( image );
See the original AForge code for example images.
Constructors
| Improve this Doc View SourceCannyEdgeDetector(Byte, Byte)
Initializes a new instance of the Canny
Declaration
public CannyEdgeDetector(byte lowThreshold, byte highThreshold)
Parameters
| Improve this Doc View SourceCannyEdgeDetector(Byte, Byte, Single, Int32)
Initializes a new instance of the Canny
Declaration
public CannyEdgeDetector(byte lowThreshold, byte highThreshold, float sigma, int radius)
Parameters
Type | Name | Description |
---|---|---|
Byte | lowThreshold | Low threshold. |
Byte | highThreshold | High threshold. |
Single | sigma | Gaussian sigma. |
Int32 | radius |
CannyEdgeDetector(Single, Nullable<Int32>)
Initializes a new instance of the Canny
Declaration
public CannyEdgeDetector(float gaussianSigma = 3F, int? gaussianRadius = default(int? ))
Parameters
Properties
| Improve this Doc View SourceGaussianSigma
Gets gaussian sigma.
Declaration
public float GaussianSigma { get; }
Property Value
Type | Description |
---|---|
Single |
GaussianSize
Gets gaussian size.
Declaration
public int GaussianSize { get; }
Property Value
Type | Description |
---|---|
Int32 |
HighThreshold
Gets or sets high threshold.
Declaration
public byte HighThreshold { get; set; }
Property Value
Type | Description |
---|---|
Byte |
Remarks
High threshold value used for hysteresis (see tutorial for more information).
Default value is set to 100.
LowThreshold
Gets or sets low threshold.
Declaration
public byte LowThreshold { get; set; }
Property Value
Type | Description |
---|---|
Byte |
Remarks
Low threshold value used for hysteresis (see tutorial for more information).
Default value is set to 20.
Methods
| Improve this Doc View SourceProcessFilter(Image<Rgb24>, Image<L8>, Rectangle)
Process the filter on the specified image.
Declaration
protected override void ProcessFilter(Image<Rgb24> source, Image<L8> destination, Rectangle rect)
Parameters
Type | Name | Description |
---|---|---|
Six |
source | Source image data. |
Six |
destination | Destination image data. |
Six |
rect | Image rectangle for processing by the filter. |