imaqFindTransformRect

NI Vision for LabWindows/CVI Function

imaqFindTransformRect

Usage

int imaqFindTransformRect(Image* image, RotatedRect searchRect, CoordinateTransform2* transform, FindTransformMode mode, const FindTransformRectOptions* 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.

imaqFindTransformRect() 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, or rake, 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 using the points found. This line defines the main axis of the coordinate system. The function then locates the intersection points between a set of parallel search lines that are perpendicular to the main axis and the edge of the object. It calculates a hit-line to the object from the edge closest to the search area detected and perpendicular to the main axis. This line defines the secondary axis of the coordinate system. The intersection between the main axis and secondary axis is the origin of the coordinate system.

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

Image Types Supported

IMAQ_IMAGE_U8

Parameters

Name

Type

Description

image Image* The image which the function uses to compute the coordinate transform.
searchRect RotatedRect The coordinate location of the rectangular search area the function looks in for the object.
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 FindTransformRectOptions* 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:

threshold 40
width 4
steepness 2
subsamplingRatio 5
mainAxisDirection IMAQ_BOTTOM_TO_TOP
secondaryAxisDirection IMAQ_LEFT_TO_RIGHT
showSearchArea FALSE
showSearchLines FALSE
showEdgesFound FALSE
showResult TRUE