template
Top  Previous  Next

template ( integer Input, integer Probe, integer Output )

Use this function to perform a binary template matching on objects in multiphase images. The function works by applying the
hitOrMiss.operator using a user-defined Probe as the foreground template and a complimentary kernel as the background template.

.
Parameters
 
Input  
 
An integer between 0 and 116 specifying the input image frame number. A value of 0 represents the DMA memory buffer of the video device. Values in the range of 100-116 correspond to hidden frames.  
 
Probe  
 
An integer between 1 and 116 specifying the frame number of the grayscale or multiphase image that contains the structuring element defining the binary template. Values in the range of 100-116 correspond to hidden frames.  
 
The size of the kernel in each dimension must not exceed 2*Overscan+1. The Overscan setting is defined in ImageWarp Preferences.  
 
Output  
 
An integer between 1 and 116 specifying the output image frame number. Values in the range of 100-116 correspond to hidden frames.  
 
Error flags

ERR_OK  
 
The flag set if successful.  
 
ERR_FAILED  
 
The flag set if failed.  

Example

This set of statements creates an image with a sample text on it and then uses TopHat operator with a foreground and background kernel to locate appearances of letter "a" in the image:  
 
setcolorspace("default")  
createIm(1,IM_MULTI,512,512,0,0,0,0,"TEXT")  
setFillColor(1, 0)  
setDrawColor(1, 2)  
setPencil(1)  
setFont("Arial", -23, 0, 0, 0, 0, 0)  
drawtext(1,"ImageWarp is universal image editing,  
processing and analysis software,  
which combines the power  
of graphic development environment,  
comprehensive image analysis toolset,  
and programming development techniques",5,20,2,255,255)  
setSelect(1,SH_RECT,SEL_NEW,28,6,42,24)  
duplicate(1,2)  
resetSelect(1)  
template(1,2,3)  
dilate(3,3,1,PR_CIRCLE)