imaqFindTransformRect2
Usage
int imaqFindTransformRect2(Image* image, const ROI* roi, FindTransformMode mode, CoordinateSystem* baseSystem, CoordinateSystem* newSystem, const FindTransformRectOptions2* findTransformOptions, const StraightEdgeOptions* straightEdgeOptions, 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. imaqFindTransformRect2() 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.
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. |
roi | const ROI* | Defines the area within which the edge detection is performed. |
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 FindTransformRectOptions2* | Specifies options for detecting edges along search lines in each ROI and for overlaying search information |
straightEdgeOptions | const StraightEdgeOptions* | Specifies the options used to fit a line in the roi. |
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) |
edgeOptions.polarity | IMAQ_SEARCH_FOR_ALL_EDGES |
edgeOptions.kernelSize | 3 |
edgeOptions.numSearchLines | 3 |
edgeOptions.minThreshold | 10.0 |
edgeOptions.interpolationType | IMAQ_BILINEAR_FIXED |
edgeOptions.columnProcessingMode | IMAQ_MEDIAN_COLUMNS |