thin
Top  Previous  Next

thin ( integer Input, integer Output [, integer Peel =0, integer Prune =-1, integer Binarize =0,
integer Mode =0 ] )

Use this function to reduce bright objects to their skeletons. For multiphase images the function works by peeling the boundaries of objects while preserving the connectivity and end points of line segments. For grayscale and true-color image the function suppresses pixels that are not part of the intensity "ridges" in the image, thus reducing bright lines to the single pixel width.

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.  
 
Output  
 
An integer between 1 and 116 specifying the output image frame number. Values in the range of 100-116 correspond to hidden frames.  
 
Peel  
 
A positive integer specifying the number of thinning steps. If this parameter is set to zero, the function will continue to iterate until the objects are completely thinned.  
Default value: 0  
 
Prune  
 
An integer specifying the number of pruning steps. Pruning will reduce the size of branches protruding from skeletons. If this parameter is set to -1, the function will continue to iterate until the objects are completely pruned.  
Default value: -1  
 
Binarize  
 
A boolean integer specifying whether grayscale and color skeletons must be converted into binary ones. This parameter is disregarded if the input image is a multiphase one. Must be one of the following values:  
 
FALSE=0 – skeletons on grayscale and color images are not converted to the binary type.  
TRUE=1 – skeletons on grayscale and color images are converted to the binary type after the thinning algorithm is applied.  
Default value: FALSE  
 
Mode  
 
An enumerated integer that describes the thinning algorithm. Must be one of the following values:  
 
M_DISTANCE=0 – fast non-iterative method based on the distance transform.  
M_ZHANG=1 – parallel iterative method based on the modified Zhang-Suen transform.  
M_DAVIES=2 – sequential iterative method based on the Davies-Plummer algorithm.  
Default value: M_DISTANCE  
 
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 extracts its skeleton:  
 
setCurDir ("samples")  
loadIm (1,"sample25.iwd")  
threshold(1,1,M_PRESET,177.,255.,TRUE,FALSE)  
fill(1,1)  
thin (1,2,0,20)