separate
Top  Previous  Next

separate ( integer Input, integer Output, integer Mode [, integer Label =0 ] )

Use this function to separate touching convex objects in a binary image or selection. The function works by performing the
distance transform of the image followed by watershed to locate the separation lines in the distance map. The metric used for computing the distance map depends on the Mode parameter.

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.  
 
Mode  
 
An enumerated integer that describes the metric used to calculate a distance:  
 
M_CITY=0 – uses a 4-connected metric (city block). Only vertical and horizontal movements are allowed.  
M_CHESS=1 – uses an 8-connected metric (chess board). Vertical, horizontal and horizontal movements are allowed.  
M_CHAMFER=2 – uses an 8-connected metric where vertical and horizontal movements are weighted with a weight of 3, while diagonal movements are weighted with a weight of 4.  
M_EUCLID=3 –approximates Euclidian distance.  
 
Label  
 
An enumerated integer that specifies if the objects must be labeled (identified) after separation.  
FALSE=0 – the objects remain binary (phase 1) after separation.  
TRUE=1 – the objects are labeled after separation  
Default value: 0  
 
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 separate connected blobs:  
 
setCurDir ("samples")  
loadIm(1,"sample4.IWD")  
threshGauss(1,1,0,1,0)  
separate(1,2,PR_CIRCLE,TRUE)