erodeKernel
Top  Previous  Next

erodeKernel ( integer Input, integer Probe, integer Output, integer Iterations )

Use this function to erode bright objects on an image and dilate dark ones. For multiphase images the function removes any foreground pixel having pixels of a different value in its neighborhood, thus shrinking the objects of interest. For grayscale and true color images the erosion finds the darkest pixel in the neighborhood and replaces the central pixel with that value. A neighborhood pattern is supplied to the function as a grayscale or binary image with pixel values set to 1s for active elements of the kernel 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.  
 
Probe  
 
An integer between 1 and 116 specifying the frame number of the grayscale or multiphase image that contains the structuring element for the operation. 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.  
 
Iterations  
 
A positive integer specifying how many times the operation will be applied.  
 
Error flags

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

Example
 
This set of statements binarizes a sample image and applies two steps of erosion with a 11x11 circular kernel loaded from a file.  
 
setCurDir ("samples")  
loadIm (1,"sample4.iwd")  
threshold(1,1,M_PRESET,0.,113.,TRUE,FALSE)  
setCurDir ("kernels")  
loadIm (2,"circle11.tif")  
erodeKernel (1,2,3,2)