image = | pruning2dImg (inBinImg) |
image = | pruning2dImg (inBinImg,nbMaxIter) |
image = | pruning2dImg_keepAll (inBinImg) |
image = | pruning2dImg_keepAll (inBinImg,nbMaxIter) |
Reduces skeleton branches. If enough iterations are processed, the branches are completely removed.
This algorithm iteratively reduces the branches of skeletons in the input binary image. For a single pass, pixels with a single neighbour are detected and are deleted. The algorithm repeats the process untill the output image does not change anymore.
However, it is possible to limit the number of iterations to keep parts of some branches by specifying the parameter nbMaxIter.
When the image contains skeletons without loop (i.e. the object that generated the skeleton does not have holes), the pruning operation completely remove the object. In order to keep a record of the presence of such objects, it is possible to call the function pruning2dImg_keepAll instead of the standard wrapper. This way, the result for a skeleton without loop is an isolated single pixel.
Here is the result of the pruning operation. The image on the left illustrates an example of pruning processing untill convergence, the middle image shows the result when applying 10 iterations and the image on the right displays the result when the skeleton wihtout loop is not deleted: