imaqFindTransformRects2

NI Vision for LabWindows/CVI Function

imaqFindTransformRects2

Usage

int imaqFindTransformRects2(Image* image, const ROI* primaryROI, const ROI* secondaryROI, FindTransformMode mode, CoordinateSystem* baseSystem, CoordinateSystem* newSystem, const FindTransformRectsOptions2* findTransformOptions, const StraightEdgeOptions* primaryStraightEdgeOptions, const StraightEdgeOptions* secondaryStraightEdgeOptions, AxisReport* axisReport);

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.

imaqFindTransformRects2() 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.

Image Types Supported

IMAQ_IMAGE_U8, IMAQ_IMAGE_I16, IMAQ_IMAGE_SGL

Parameters

Name

Type

Description

image Image* The image which the function uses to compute the coordinate transform.
primaryROI const ROI* Defines the area within which the edge detection is performed for the primary axis.
secondaryROI const ROI* Defines the area within which the edge detection is performed for the secondary axis.
mode FindTransformMode Specifies how the function updates the coordinate transform.
baseSystem CoordinateSystem* Describes the base coordinate system. This parameter is required and cannot be NULL.
newSystem CoordinateSystem* Describes the new coordinate system. This parameter is required and cannot be NULL.
findTransformOptions const FindTransformRectsOptions2* Defines the parameters of the algorithm the function uses to locate the object and the information the function overlays to the image.
primaryStraightEdgeOptions const StraightEdgeOptions* Specifies the options used to fit a line in the primaryROI.
secondaryStraightEdgeOptions const StraightEdgeOptions* Specifies the options used to fit a line in the secondaryROI.
axisReport AxisReport* On return, contains the axes that were located. Set this parameter to NULL if you do not want to return the axis 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

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

direction IMAQ_LEFT_TO_RIGHT_DIRECT
showSearchArea FALSE
showSearchLines FALSE
showEdgesFound FALSE
showResult TRUE
searchAreaColor IMAQ_RGB_GREEN
searchLinesColor IMAQ_RGB_BLUE
searchEdgesColor IMAQ_RGB_YELLOW
resultColor IMAQ_RGB_RED
overlayGroupName "" (default group)
primaryEdgeOptions.polarity IMAQ_SEARCH_FOR_ALL_EDGES
primaryEdgeOptions.kernelSize 3
primaryEdgeOptions.numSearchLines 3
primaryEdgeOptions.minThreshold 10.0
primaryEdgeOptions.interpolationType IMAQ_BILINEAR_FIXED
primaryEdgeOptions.columnProcessingMode IMAQ_MEDIAN_COLUMNS
secondaryEdgeOptions.polarity IMAQ_SEARCH_FOR_ALL_EDGES
secondaryEdgeOptions.kernelSize 3
secondaryEdgeOptions.numSearchLines 3
secondaryEdgeOptions.minThreshold 10.0
secondaryEdgeOptions.interpolationType IMAQ_BILINEAR_FIXED
secondaryEdgeOptions.columnProcessingMode IMAQ_MEDIAN_COLUMNS