CannyEdgeFilter Method

NI Vision for Visual Basic

CannyEdgeFilter Method

Syntax

CWIMAQVision.CannyEdgeFilter SourceImage, DestImage [, Sigma = 1.00] [, LowerThreshold = 0.20] [, UpperThreshold = 0.70] [, WindowSize = 9]

Return Type

Long

On success, this method returns 0. On failure, this method returns a negative number.

Purpose

Outlines edges in an image using the Canny algorithm, which is well-suited to images with poor signal-to-noise ratios.

Remarks

Use this method with U8 images.

Parameters

SourceImage As CWIMAQImage

The image to process.

DestImage As CWIMAQImage

The results of the processing.

Sigma As Variant

[Optional] The sigma of the Gaussian smoothing filter that the method applies to the image before edge detection.

This parameter has a default value of 1.00.

LowerThreshold As Variant

[Optional] The value that the method multiplies by UpperThreshold to determine the lower threshold for all the pixels in an edge segment.

This parameter has a default value of 0.20.

UpperThreshold As Variant

[Optional] The upper fraction of pixel values in the image from which the method chooses a seed or starting point of an edge segment. This value must be between 0 and 1.

This parameter has a default value of 0.70.

WindowSize As Variant

[Optional] The window size of the Gaussian filter that the method applies to the image. This value must be odd.

This parameter has a default value of 9.

Example

Dim i As New CWIMAQImage

'Threshold the image in Viewer1 inplace.
CWIMAQVision1.Threshold CWIMAQViewer1.Image, CWIMAQViewer1.Image, _
                        128, 255, , 255

'Outline the edges of the image in Viewer1 and 
'store the results in i
CWIMAQVision1.CannyEdgeFilter CWIMAQViewer1.Image, i

See Also

Threshold