imaqDetectRotation
Usage
int imaqDetectRotation(const Image* referenceImage, const Image* testImage, PointFloat referenceCenter, PointFloat testCenter, int radius, float precision, double* angle);
Purpose
Detects the rotational shift between two images, usually a reference image containing a part at a known orientation and another image containing the part in an unknown position. This function extracts pixel values around a circular region in the reference image and compares these values to the same region in the test image. The algorithm looks for the rotational shift between those two samples.
Image Types Supported
IMAQ_IMAGE_U8, IMAQ_IMAGE_I16, IMAQ_IMAGE_SGL
Parameters
Name
|
Type
|
Description
|
---|---|---|
referenceImage | const Image* | The reference image. |
testImage | const Image* | The test image. |
referenceCenter | PointFloat | The center point of the circular region in the reference image. |
testCenter | PointFloat | The center point of the circular region in the test image. |
radius | int | The radius of the circles used to detect rotation. |
precision | float | The sampling period, in degrees, of the pixel values that the function extracts from the circular region. |
angle | double* | On return, the angle, in degrees, between the two images. This parameter is required and cannot be 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
precision—The sampling period directly affects the speed of the function. If the sampling period is high (meaning that the number of samples along the circular region is small), the processing speed of the function increases at the cost of reduced accuracy in the computed rotational shift. In many cases, you do not need a precision higher than 5 degrees to position the regions of inspection of a part. If the sampling period is less than or equal to 0, the function returns an error.