MatchTemplateWalsh
Match a template image with every location in the source image (using the Walsh transform) and return the comparison results.
Can use available TwinCAT Job Tasks for executing parallel code regions.
Can return partial results when canceled by Watchdog.
Syntax
Definition:
HRESULT MatchTemplateWalsh(
HRESULT hrPrev,
ITcVnImage* ipSrcImage,
ITcVnImage* ipTemplateImage,
ITcVnImage*& ipResultImage,
ULONG nProjections,
ULONG eOptions = MTWO_NONE,
ULONG nRotations = 1
)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) | |
|
ipResultImage |
|
Returns the result image (REAL, normalized to [0..1], nRotations channel(s), dimensions: (ipSrcImage.width - ipTemplateImage.width + 1) x (ipSrcImage.height - ipTemplateImage.height + 1). The best match is the global minimum over all channels. The position in ipResultImage is the top-left corner of ipTemplateImage position in ipSrcImage. The rotation can be inferred from the channel the minimum is found in.) | |
|
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. |
|
eOptions |
ULONG |
MTWO_NONE |
Flags controlling the matching process. (see ETcVnMatchTemplateWalshOptions) |
|
nRotations |
ULONG |
1 |
Number of rotations to be checked. (valid values: 1 (0°), 2 (0° and 180°), and 4 (0°, 90°, 180°, and 270°; only for square images)) |
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 |