MatchTemplate
Match a template image with every location in the source image and save the comparison results.
Can return partial results when canceled by Watchdog.
Syntax
Definition:
HRESULT MatchTemplate(
HRESULT hrPrev,
ITcVnImage* ipSrcImage,
ITcVnImage* ipTemplateImage,
ITcVnImage*& ipResultImage,
ETcVnTemplateMatchMethod eMatchMethod = TMM_CCORR_NORMED,
ITcVnImage* ipTemplateMask = 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 REAL, 1 or 3 channels) | |
ipTemplateImage |
|
Template image (same type as ipSrcImage, smaller width and height) | |
ipResultImage |
|
Returns the result image (REAL, 1 channel, dimensions: (ipSrcImage.width - ipTemplateImage.width + 1) x (ipSrcImage.height - ipTemplateImage.height + 1). The best match is the global minimum (SQDIFF(_NORMED)) or maximum (CCORR(_NORMED), CCOEFF(_NORMED)). The position in ipResultImage is the top-left corner of ipTemplateImage position in ipSrcImage) | |
eMatchMethod |
TMM_CCORR_NORMED |
Specifies the template match method | |
ipTemplateMask |
nullptr |
Optional mask for ipTemplateImage (same type and size as ipTemplateImage) |
Required License
TC3 Vision Matching
System Requirements
Development environment | Target platform | PLC libraries to include |
---|---|---|
TwinCAT V3.1.4024.54 or later | PC or CX (x64) with PL50, e.g. Intel 4-core Atom CPU | Tc3_Vision |