Danielsson Method

NI Vision for Visual Basic

Danielsson Method

Syntax

CWIMAQVision.Danielsson SourceImage, DestImage

Return Type

Long

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

Purpose

Creates a very accurate distance map based on the Danielsson distance algorithm. The method encodes the pixel value of a particle as a function of the distance of the pixel from the particle perimeter. For a faster but less precise algorithm, use the Distance method.

Remarks

This method modifies the source image. If you need the original source image, create a copy of the image using the CWIMAQVision.Copy method before using this method.

Use this method with U8 and I16 images. The method modifies the border of the source image. The border must be at least one pixel wide.

Parameters

SourceImage As CWIMAQImage

The image that the method uses to compute the distance map.

DestImage As CWIMAQImage

The image that contains the result.

Example

' This example assumes you have two viewers on your form.
Dim i As New CWIMAQImage

' Threshold the image in Viewer1 and store the results in i.
CWIMAQVision1.Threshold CWIMAQViewer1.Image, i, 128, 255, , 255

' Create a distance map of i using the Danielsson algorithm.
' Store the result in the image in Viewer2.
CWIMAQVision1.Danielsson i, CWIMAQViewer2.Image

' View the results on Viewer2 using a binary palette.
CWIMAQViewer2.Palette.Type = cwimaqPaletteBinary

See Also

Distance