FitLine Method

NI Vision for Visual Basic

FitLine Method

Syntax

CWIMAQVision.FitLine Points, FitLineReport [, MinimumScore = 900] [, PixelRadius = 3.00] [, MaximumIterations = 0]

Return Type

Long

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

Purpose

Finds the line that best represents a set of points.

Remarks

The resulting line may only take into account a subset of the input points.

Parameters

Points As CWIMAQPoints

The coordinates of the points to use for the fit. This collection must contain two or more point items corresponding to two or more points on the line.

FitLineReport As CWIMAQFitLineReport

On return, a report containing information about the line that best represents the set of points.

MinimumScore As Variant

[Optional] Specifies the required quality of the fitted line. The score can vary from 0 to 1,000.

This parameter has a default value of 900.

PixelRadius As Variant

[Optional] Specifies the neighborhood pixel relationship for the initial subset of points being used.

This parameter has a default value of 3.00.

MaximumIterations As Variant

[Optional] Specifies the number of refinements allowed on the initial subset of points. If this value is zero, then the number of refinements is two less than the number of points supplied.

This parameter has a default value of 0.

Example

Dim report As New CWIMAQFitLineReport
Dim points As New CWIMAQPoints

' Find the line that passes through
' (1,1), (-1,1)
points.Initialize Array(1, -1), Array(1, 1)
CWIMAQVision1.FitLine points, report