scrap
Top  Previous  Next

scrap ( integer Input, integer Output, integer Min =0, integer Max [, integer Mode =0 ] )

Use this function to remove small objects in a multiphase image or selection. The function works by counting pixels in the 8-connected blobs. If the number of pixels in an object lies within the selected range, the object is identified as scrap and removed from the image. An alternative mode of the function extracts such objects and removes all other objects.

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.  
 
Min, Max  
 
Positive integers specifying the minimum and maximum limit for a number of pixels in the objects to be identified as scrap.  
 
Mode  
 
An enumerated integer that describes the mode in which the function operates. Must be one of the following values: the borders to be used for objects removal. Must be one of the following values:  
M_REMOVE – erases the objects identified as scrap from the image.  
M_SELECT – extracts the objects identified as scrap from the image.  
Default value: M_REMOVE  

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 having a number of pixels in a range of 1-200.  
 
setCurDir("samples")  
loadIm (1,"sample8.iwd")  
threshRGB(1, 1 , M_PRESET , TRUE, 1, 87,213, 46,151, 143,220)  
scrap (1,2,0,200)