hitOrMiss
Top  Previous  Next

hitOrMiss ( integer Input, integer Probe1, integer Probe2, integer Output )

Use this function to select out pixels that have certain geometrical properties by performing hit-or-miss transform. The function works with a neighboring pattern that contains pixels divided into three classes: those that must be ON, those that must be OFF, and those that are ignored. This is done by using two complimentary kernels, one for the foreground pattern and another one for the background pattern. The function applies erosion with the Probe1 kernel followed by dilation with Probe2. This effectively extracts those objects "hit" by the first kernel and "missed" by the second one.

The neighborhood patterns are supplied to the function as grayscale or binary image with pixel values set to 1s for active elements of the kernels and to 0s for elements to be ignored.

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.  
 
Probe1  
 
An integer between 1 and 116 specifying the frame number of the grayscale or multiphase image that contains the structuring element defining the condition for the foreground pixels. 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.  
 
Probe2  
 
An integer between 1 and 116 specifying the frame number of the grayscale or multiphase image that contains the structuring element defining the condition for the background pixels. 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  
 
Output  
 
An integer between 1 and 116 specifying the output image frame number. Values in the range of 100-116 correspond to hidden frames.  
 
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,5,2,255,255)  
setSelect(1,SH_RECT,SEL_NEW,28,6,42,24)  
duplicate(1,2)  
resetSelect(1)  
createIm(3,IM_MULTI,14,18,0,0,0,0,"Back")   
drawRect(3, 0, 0, 14, 18, FALSE)  
hitormiss(1,2,3,4)  
dilate(4,4,1,PR_CIRCLE)