border
Top  Previous  Next

border ( integer Input, integer Output [, integer Edge =0, [, integer Borders =0 ] )

Use this function to remove objects that touch the borders in a multiphase image or selection The function works by assigning the zero value to those foreground pixels located within the selected distance from the image border or selection outline.

Parameters
 
Input  
 
An integer between 1 and 116 specifying the input 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.  
 
Edge  
 
A positive integer specifying the minimal distance from the border allowed for the objects. If at least one pixel of the object is located closer to the boundary, the object will be erased.  
Default value: 0  
 
Borders  
 
An enumerated integer specifying the borders to be used for objects removal. Must be one of the following values:  
BD_ALL=0 – removes objects touching any border of the image.  
BD_TOP – removes objects touching the top border of the image.  
BD_LEFT – removes objects touching the left border of the image.  
BD_BOTTOM – removes objects touching the bottom border of the image.  
BD_RIGHT – removes objects touching the top right of the image.  
BD_TOPLEFT – removes objects touching the top and left borders of the image.  
BD_BOTTOMRIGHT – removes objects touching the bottom and right borders of the image.  
BD_TOPRIGHT – removes objects touching the top and right borders of the image.  
BD_BOTTOMLEFT – removes objects touching the bottom and left borders of the image.  
Default value: BD_ALL  
 
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 removes objects touching its borders.  
 
setCurDir ("samples")  
loadIm(1,"sample4.IWD")  
threshGauss(1,1,0,1,0)  
border(1,2)