imaqMatchShape
Usage
ShapeReport* imaqMatchShape(Image* dest, Image* source, const Image* templateImage, int scaleInvariant, int connectivity8, double tolerance, int* numMatches);
Purpose
Finds a shape in an image. In most cases, use imaqMatchPattern() instead of this function. For information about when to use shape matching, see Chapter 12, Pattern Matching, of the NI Vision Concepts Manual.
Image Types Supported
IMAQ_IMAGE_U8, IMAQ_IMAGE_I16
Parameters
Name
|
Type
|
Description
|
---|---|---|
dest | Image* | On return, the objects in the source image that match the object in the template image. |
source | Image* | The image in which the function searches for shapes. |
templateImage | const Image* | The 8-bit image containing the shape to find. |
scaleInvariant | int | Set this parameter to TRUE to search for shapes regardless of size. Set this parameter to FALSE to search for shapes that are ±10 percent of the size of the template shape. |
connectivity8 | int | Set this parameter to TRUE to use connectivity-8 to determine whether particles are touching. Set this parameter to FALSE to use connectivity-4 to determine whether particles are touching. For more information about connectivity, see Chapter 9, Binary Morphology, in the NI Vision Concepts Manual. |
tolerance | double | Indicates the allowable difference between the template shape and similar shapes in the image. The difference is expressed as a value from 0 to 1. |
numMatches | int* | On return, the number of matches to the template image. Set this parameter to NULL if you do not need this information. |
Return Value
Type |
Description |
---|---|
ShapeReport* | On success, this function returns an array of reports describing the matches to the given template shape. On failure, this function returns NULL. To get extended error information, call imaqGetLastError(). When you are finished with the array, dispose of it by calling imaqDispose(). |
Parameter Discussion
source—This function modifies the source image. If you need the original image, create a copy of the image using imaqDuplicate() before using this function.