CannyEdgeOptions Class

Immutable options of the Canny edge detector (ImageProcessingExtensions.DetectCannyEdges): the blur that removes the noise, and the two thresholds of the hysteresis.

public sealed class CannyEdgeOptions

Remarks

The thresholds are fractions of the sample range, compared with the magnitude of the gradient of the Sobel operator (ConvolutionKernel.SobelX, ConvolutionKernel.SobelY), which is not normalized: a step from black to white across a straight vertical edge has a magnitude of 4. OpenCV's cv2.Canny takes the same thresholds multiplied by 255 for 8-bit images, and scikit-image's canny the same values for floating-point images.

Constructors

NameDescription
CannyEdgeOptions()

CannyEdgeOptions()

CannyEdgeOptions.cs
public CannyEdgeOptions()

No documentation is available.

Properties

NameDescription
DefaultGets the default options: a blur of standard deviation 1, and the thresholds 0.1 and 0.2 (the defaults of scikit-image).
HighThresholdGets the upper threshold, a fraction of the sample range: a pixel whose gradient is a local maximum and greater than it is an edge. Defaults to 0.2. It must not be lower than CannyEdgeOptions.LowThreshold.
LowThresholdGets the lower threshold, a fraction of the sample range: a pixel whose gradient is a local maximum and greater than it is an edge when it is connected to a pixel greater than CannyEdgeOptions.HighThreshold by such pixels. Defaults to 0.1.
SigmaGets the standard deviation of the Gaussian blur applied to the luminance before its gradient is computed, in pixels: the weights of ImageProcessingExtensions.GaussianBlur, with the pixels outside the image read as the nearest edge pixel. Defaults to 1. A larger value ignores more noise and finer details; 0 does not blur, as OpenCV's cv2.Canny.

Gets the default options: a blur of standard deviation 1, and the thresholds 0.1 and 0.2 (the defaults of scikit-image).

public static CannyEdgeOptions Default { get; }

Property value

CannyEdgeOptions

HighThreshold

CannyEdgeOptions.cs

Gets the upper threshold, a fraction of the sample range: a pixel whose gradient is a local maximum and greater than it is an edge. Defaults to 0.2. It must not be lower than CannyEdgeOptions.LowThreshold.

public double HighThreshold { get; init; }

Property value

double

Exceptions

ArgumentException
The value is not a finite number.
ArgumentOutOfRangeException
The value is negative.

Gets the lower threshold, a fraction of the sample range: a pixel whose gradient is a local maximum and greater than it is an edge when it is connected to a pixel greater than CannyEdgeOptions.HighThreshold by such pixels. Defaults to 0.1.

public double LowThreshold { get; init; }

Property value

double

Exceptions

ArgumentException
The value is not a finite number.
ArgumentOutOfRangeException
The value is negative.

Gets the standard deviation of the Gaussian blur applied to the luminance before its gradient is computed, in pixels: the weights of ImageProcessingExtensions.GaussianBlur, with the pixels outside the image read as the nearest edge pixel. Defaults to 1. A larger value ignores more noise and finer details; 0 does not blur, as OpenCV's cv2.Canny.

public double Sigma { get; init; }

Property value

double

Exceptions

ArgumentException
The value is not a finite number.
ArgumentOutOfRangeException
The value is negative or exceeds 10000.