IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit

Reduces skeleton branches. If enough iterations are processed, the branches are completely removed. More...

IPSDKIPLBASICMORPHOLOGY_API image::ImagePtr ipsdk::imaproc::morpho::pruning2dImg (const image::ImageConstPtr &pInBinImg)
 wrapper function for Reduces skeleton branches. If enough iterations are processed, the branches are completely removed More...
 
IPSDKIPLBASICMORPHOLOGY_API image::ImagePtr ipsdk::imaproc::morpho::pruning2dImg (const image::ImageConstPtr &pInBinImg, const ipsdk::ipUInt32 nbMaxIter)
 wrapper function for Reduces skeleton branches. If enough iterations are processed, the branches are completely removed More...
 
IPSDKIPLBASICMORPHOLOGY_API image::ImagePtr ipsdk::imaproc::morpho::pruning2dImg_keepAll (const image::ImageConstPtr &pInBinImg)
 wrapper function for Reduces skeleton branches. If enough iterations are processed, the branches are completely removed More...
 
IPSDKIPLBASICMORPHOLOGY_API image::ImagePtr ipsdk::imaproc::morpho::pruning2dImg_keepAll (const image::ImageConstPtr &pInBinImg, const ipsdk::ipUInt32 nbMaxIter)
 wrapper function for Reduces skeleton branches. If enough iterations are processed, the branches are completely removed More...
 
IPSDKIPLBASICMORPHOLOGY_API void ipsdk::imaproc::morpho::pruning2dImg (const image::ImageConstPtr &pInBinImg, const image::ImagePtr &pOutBinImg)
 wrapper function for Reduces skeleton branches. If enough iterations are processed, the branches are completely removed More...
 
IPSDKIPLBASICMORPHOLOGY_API void ipsdk::imaproc::morpho::pruning2dImg (const image::ImageConstPtr &pInBinImg, const ipsdk::ipUInt32 nbMaxIter, const image::ImagePtr &pOutBinImg)
 wrapper function for Reduces skeleton branches. If enough iterations are processed, the branches are completely removed More...
 
IPSDKIPLBASICMORPHOLOGY_API void ipsdk::imaproc::morpho::pruning2dImg_keepAll (const image::ImageConstPtr &pInBinImg, const image::ImagePtr &pOutBinImg)
 wrapper function for Reduces skeleton branches. If enough iterations are processed, the branches are completely removed More...
 
IPSDKIPLBASICMORPHOLOGY_API void ipsdk::imaproc::morpho::pruning2dImg_keepAll (const image::ImageConstPtr &pInBinImg, const ipsdk::ipUInt32 nbMaxIter, const image::ImagePtr &pOutBinImg)
 wrapper function for Reduces skeleton branches. If enough iterations are processed, the branches are completely removed More...
 

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

Attributes description

Attribute description for algorithm :

Name ToolTip Default Initializer
ipsdk::imaproc::attr::InBinImg [Input] binary image for processing operation X
ipsdk::imaproc::attr::InOptNbMaxIter [Input Optional] Maximum number of iterations (ignored if equals to 0) X
ipsdk::imaproc::attr::InRemoveSkeletonsWithoutHoles [Input] If the attribute equals true, the skeletons corresponding to objects without holes are completely removed. If the value is false, a single pixel remains for these objects X
ipsdk::imaproc::attr::OutBinImg [Output] binary image for processing operation ipsdk::imaproc::duplicateInOut (_pOutBinImg, _pInBinImg)

Global Rule description

Global rule description for algorithm :
ipsdk::imaproc::matchSizeAndType (_pInBinImg,_pOutBinImg)

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

Associated library

IPSDKIPLBasicMorphology

Header file

Code Example

// opening input image
ImagePtr pInBinImg = loadTiffImageFile(inputImgPath);
// compute pruning on input image
ImagePtr pOutImg = pruning2dImg(pInBinImg);
See also
Pruning2dImgLvl1
Pruning2dImgLvl2
Pruning2dImgLvl3

Function Documentation

◆ pruning2dImg() [1/4]

IPSDKIPLBASICMORPHOLOGY_API image::ImagePtr ipsdk::imaproc::morpho::pruning2dImg ( const image::ImageConstPtr pInBinImg)

wrapper function for Reduces skeleton branches. If enough iterations are processed, the branches are completely removed

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ pruning2dImg() [2/4]

IPSDKIPLBASICMORPHOLOGY_API image::ImagePtr ipsdk::imaproc::morpho::pruning2dImg ( const image::ImageConstPtr pInBinImg,
const ipsdk::ipUInt32  nbMaxIter 
)

wrapper function for Reduces skeleton branches. If enough iterations are processed, the branches are completely removed

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ pruning2dImg_keepAll() [1/4]

IPSDKIPLBASICMORPHOLOGY_API image::ImagePtr ipsdk::imaproc::morpho::pruning2dImg_keepAll ( const image::ImageConstPtr pInBinImg)

wrapper function for Reduces skeleton branches. If enough iterations are processed, the branches are completely removed

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ pruning2dImg_keepAll() [2/4]

IPSDKIPLBASICMORPHOLOGY_API image::ImagePtr ipsdk::imaproc::morpho::pruning2dImg_keepAll ( const image::ImageConstPtr pInBinImg,
const ipsdk::ipUInt32  nbMaxIter 
)

wrapper function for Reduces skeleton branches. If enough iterations are processed, the branches are completely removed

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ pruning2dImg() [3/4]

IPSDKIPLBASICMORPHOLOGY_API void ipsdk::imaproc::morpho::pruning2dImg ( const image::ImageConstPtr pInBinImg,
const image::ImagePtr pOutBinImg 
)

wrapper function for Reduces skeleton branches. If enough iterations are processed, the branches are completely removed

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ pruning2dImg() [4/4]

IPSDKIPLBASICMORPHOLOGY_API void ipsdk::imaproc::morpho::pruning2dImg ( const image::ImageConstPtr pInBinImg,
const ipsdk::ipUInt32  nbMaxIter,
const image::ImagePtr pOutBinImg 
)

wrapper function for Reduces skeleton branches. If enough iterations are processed, the branches are completely removed

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ pruning2dImg_keepAll() [3/4]

IPSDKIPLBASICMORPHOLOGY_API void ipsdk::imaproc::morpho::pruning2dImg_keepAll ( const image::ImageConstPtr pInBinImg,
const image::ImagePtr pOutBinImg 
)

wrapper function for Reduces skeleton branches. If enough iterations are processed, the branches are completely removed

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ pruning2dImg_keepAll() [4/4]

IPSDKIPLBASICMORPHOLOGY_API void ipsdk::imaproc::morpho::pruning2dImg_keepAll ( const image::ImageConstPtr pInBinImg,
const ipsdk::ipUInt32  nbMaxIter,
const image::ImagePtr pOutBinImg 
)

wrapper function for Reduces skeleton branches. If enough iterations are processed, the branches are completely removed

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure