imaqLearnGeometricPattern

NI Vision for LabWindows/CVI Function

imaqLearnGeometricPattern

Usage

int imaqLearnGeometricPattern(Image* image, PointFloat originOffset, const CurveOptions* curveOptions, const LearnGeometricPatternAdvancedOptions* advancedLearnOptions, const Image* mask);

Purpose

Creates a description of the template image you want to search for during the matching phase.

Image Types Supported

IMAQ_IMAGE_U8

Parameters

Name

Type

Description

image Image* The image about which the function learns pattern matching information. The function appends the pattern matching information to this image.
originOffset PointFloat Specifies the number of pixels the function shifts the origin of the template from the center of the template image. The origin of the template is used by imaqMatchGeometricPattern() to set the position element of the resulting GeometricPatternMatch struct for each template match within a target image. Set this parameter to IMAQ_NO_OFFSET to use the center of the template image as the origin of the template.
curveOptions const CurveOptions* Describes how the function identifies the curves in the image the function will use to create the template image. This function does not support identifying curves with subpixel accuracy and therefore ignores the subpixelAccuracy element of this parameter.
advancedLearnOptions const LearnGeometricPatternAdvancedOptions* Advanced options for determining the information the algorithm learns about the geometric pattern.
mask const Image* An optional image, which is the same size as the template, that specifies where to search for curves in the template. mask must be an IMAQ_IMAGE_U8 image. To allow the function to process all of the pixels to determine if the pixels contain curves, set this parameter to NULL.

Return Value

Type

Description

int On success, this function returns a non-zero value. On failure, this function returns 0. To get extended error information, call imaqGetLastError().

Parameter Discussion

curveOptions—Set curveOptions to NULL to use the default curve options, as follows:

extractionMode IMAQ_NORMAL_IMAGE
threshold 75
filterSize IMAQ_NORMAL
minLength 25
rowStepSize 15
columnStepSize 15
maxEndPointGap 10
onlyClosed FALSE
subpixelAccuracy FALSE

advancedLearnOptions—Set advancedLearnOptions to NULL to use the default advanced learning options, as follows:

minRectLength 10
minRectAspectRatio 0.2
minRadius 5
minLineLength 15
minFeatureStrength 0.5
maxFeaturesUsed 25
maxPixelDistanceFromLine 2

mask—Use one or more of the following pixel values when constructing the mask:

0–Maintains the default behavior. The corresponding pixel in the template image is considered part of a curve only if it meets the conditions specified by curveOptions.

1–The corresponding pixel in the template image is never considered part of a curve.

2–The corresponding pixel in the template image is always considered part of a curve.

4–The corresponding pixel in the template image is not used by imaqMatchGeometricPattern() when computing the correlationScore returned for each match. You can combine this pixel value with values 1 or 2 to control both the curve detection and scoring for the corresponding pixel.