imaqFindTransformRects

NI Vision for LabWindows/CVI Function

imaqFindTransformRects

Usage

int imaqFindTransformRects(Image* image, RotatedRect primaryRect, RotatedRect secondaryRect, CoordinateTransform2* transform, FindTransformMode mode, const FindTransformRectsOptions* options, AxisReport* report);

Purpose

Computes a coordinate transform based on the position of an object in a search area of an image. The function uses the location and orientation of the coordinate system it finds to create the reference system of a coordinate transform or to update the measurement system of an existing coordinate transform.

imaqFindTransformRects() uses the following algorithm. First the function determines the position of the main axis of the coordinate system. It locates the intersection points between a set of parallel search lines in the primary rectangle and the edge of an object. The function determines the intersection points based on their contrast, width, and steepness. The function calculates a best-fit line through the points found. This line defines the main axis of the coordinate system. The process is repeated perpendicularly in the secondary rectangle in order to locate the secondary axis. The intersection between the main axis and the secondary axis is the origin of the coordinate system.

Note   This function is obsolete. Use imaqFindTransformRects2() instead.

Image Types Supported

IMAQ_IMAGE_U8

Parameters

Name

Type

Description

image Image* The image which the function uses to compute the coordinate transform.
primaryRect RotatedRect Specifies the rectangular search area the function looks in for the object edge corresponding to the main axis .
secondaryRect RotatedRect Specifies the rectangular search area the function looks in for the object edge corresponding to the secondary axis .
transform CoordinateTransform2* The coordinate transform the function updates based on the location and position of the object. This parameter is required and cannot be NULL.
mode FindTransformMode Specifies how the function updates the coordinate transform.
options const FindTransformRectsOptions* Defines the parameters of the algorithm the function uses to locate the object and the information the function overlays to the image.
report AxisReport* On return, a report describing the location of the edges corresponding to the main axis and the secondary axis. Set this parameter to NULL if you do not need this information.

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

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

primaryThreshold 40
primaryWidth 4
primarySteepness 2
primarySubsamplingRatio 5
secondaryThreshold 40
secondaryWidth 4
secondarySteepness 2
secondarySubsamplingRatio 5
mainAxisDirection IMAQ_BOTTOM_TO_TOP
secondaryAxisDirection IMAQ_LEFT_TO_RIGHT
showSearchArea FALSE
showSearchLines FALSE
showEdgesFound FALSE
showResult TRUE