FindTemplateWalshExp (AngleRange)
Match a template image with every location in the source image (using the Walsh transform) and evaluate the comparison results. Returns a sorted list of possible matches (best match first).
Can use available TwinCAT Job Tasks for executing parallel code regions.
Can return partial results when canceled by Watchdog.
Syntax
Definition:
HRESULT FindTemplateWalsh(
HRESULT hrPrev,
ITcVnImage* ipSrcImage,
ITcVnImage* ipTemplateImage,
ITcVnContainer*& ipMatches,
float fMatchThreshold,
ULONG nProjections,
double fStartAngle,
double fStopAngle,
ULONG nAngles,
ULONG eOptions = FTWO_NONE,
float fScaleFactor = 1,
ETcVnInterpolationType eInterpolationType = IT_BILINEAR,
ITcVnContainer** pipMatchValues = nullptr
)Parameters
|
Name |
Type |
Default |
Description |
|---|---|---|---|
|
hrPrev |
|
HRESULT indicating the result of previous operations (If SUCCEEDED(hrPrev) equals false, no operation is executed.) | |
|
ipSrcImage |
|
Source image (USINT or SINT, 1 or 3 channels) | |
|
ipTemplateImage |
|
Template image (same type as ipSrcImage, smaller width and height) | |
|
ipMatches |
|
Returns the matching positions (container type depends on eOptions; ContainerType_Vector_TcVnRotatedRectangle or ContainerType_Vector_TcVnVector4_REAL, where each element contains the center (x, y), the rotation angle in degrees, and the matching value of ipTemplateImage in ipSrcImage; container elements sorted by relevance (best match first)) | |
|
fMatchThreshold |
float |
|
Threshold to separate relevant from irrelevant matches (0..1, 1.0 would be a perfect match.) |
|
nProjections |
ULONG |
|
Number of Walsh projections to be used. The higher nProjections the more details are considered for matching. As the most relevant information is captured by the first Walsh projections, a small number (e.g., 5, 10, 25, or 50) is sufficient for many use cases. Each projection requires additional computation time. Therefore, it is advantageous to choose a low number of Walsh projections as long as the matching requirements are fulfilled. The allowed maximum of nProjections is determined by the width and the height of the template image. |
|
fStartAngle |
double |
|
First search angle |
|
fStopAngle |
double |
|
Last search angle |
|
nAngles |
ULONG |
|
Number of different search angles to be used |
|
eOptions |
ULONG |
FTWO_NONE |
Flags controlling the matching process. (see ETcVnFindTemplateWalshOptions; default: TCVN_FTWO_NONE) |
|
fScaleFactor |
float |
1 |
Factor (0..1] to reduce source and template image width and height for better performance (but less accuracy!) |
|
eInterpolationType |
IT_BILINEAR |
Image resize interpolation type (only used if fScaleFactor != 1, TCVN_IT_BILINEAR recommended for most cases) | |
|
pipMatchValues |
nullptr |
Optionally returns the matching values (ContainerType_Vector_REAL, same size and sort order as ipMatches. Set to 0 if not required.) |
Required License
TC3 Vision Matching
System Requirements
Development environment | Target platform | PLC libraries to include |
|---|---|---|
TwinCAT V3.1.4026 or later | PC or CX (x64) with min. PL50, e.g. Intel 4-core Atom CPU | Tc3_Vision |