IPSDK 0.2
IPSDK : Image Processing Software Development Kit
Pruning of 2d skeletonsSee full documentation
imagepruning2dImg (inBinImg)
imagepruning2dImg (inBinImg,nbMaxIter)
imagepruning2dImg_keepAll (inBinImg)
imagepruning2dImg_keepAll (inBinImg,nbMaxIter)

Detailed Description

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:

Pruning2dImg.png

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLBasicMorphology as morpho

Code Example

# opening of input image
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
# boundary 2d image computation
outImg = morpho.pruning2dImg(inImg)

Example of C++ code :

Example informations

Header file

#include <IPSDKIPL/IPSDKIPLBasicMorphology/Processor/Pruning2dImg/Pruning2dImg.h>

Code Example

// opening input image
ImagePtr pInBinImg = loadTiffImageFile(inputImgPath);
// compute pruning on input image
ImagePtr pOutImg = pruning2dImg(pInBinImg);