imaqCountObjects
Usage
ObjectReport* imaqCountObjects(Image* image, RotatedRect searchRect, const CountObjectsOptions* options, const CoordinateTransform2* transform, int* numObjects);
Purpose
Locates, counts, and measures objects in a rectangular search area. This function uses a threshold on the pixel intensities to segment the objects from their background. The function then locates and measures the segmented objects.
Image Types Supported
IMAQ_IMAGE_U8, IMAQ_IMAGE_I16, IMAQ_IMAGE_SGL
Parameters
Name
|
Type
|
Description
|
---|---|---|
image | Image* | The image that the function uses for object analysis. |
searchRect | RotatedRect | The coordinate location of the rectangular search area of the object analysis. Set this parameter to IMAQ_NO_ROTATED_RECT to search the entire image. |
options | const CountObjectsOptions* | Defines the parameters of the algorithm the function uses to locate the objects and the information the function overlays to the image. |
transform | const CoordinateTransform2* | An optional specification of the coordinate transform for searchRect. This parameter specifies how to transform the location of the object detection based on the difference between the reference coordinate system and the measurement coordinate system. Set this parameter to NULL if you do not need to transform searchRect. |
numObjects | int* | On return, the number of objects that the function found. Set this parameter to NULL if you do not need this information. |
Return Value
Type |
Description |
---|---|
ObjectReport* | On success, this function returns an array of reports describing each of the objects found by the function. On failure, this function returns NULL. To get extended error information, call imaqGetLastError(). When you are finished with the information, dispose of it by calling imaqDispose(). |
Parameter Discussion
options—Set the options parameter to NULL to use the default options, as follows:
type | IMAQ_BRIGHT_OBJECTS |
threshold | 128 |
rejectBorder | FALSE |
fillHoles | FALSE |
useMinSize | FALSE |
minSize | 0 |
useMaxSize | FALSE |
maxSize | 0 |
showSearchArea | FALSE |
showObjectCenter | TRUE |
showBoundingBox | TRUE |