IPSDK 4.1.0.2
IPSDK : Image Processing Software Development Kit
Skeleton 2d calculation
imageskeleton2dImg (inBinImg)
imageskeleton2dImg (inBinImg,skeletonAlgoType)

Detailed Description

computes the 2d skeleton image from a binary image

The skeleton provides morphological and topological properties of an object. This function computes the image of skeletons from the objects present in the input binary image by iterative thinnings.

Two algorithms are available to compute the default or the smooth skeletons from the input binary image.

For the first approach, the objects are iteratively reduced by eliminating all pixels at the borders except the corners. This thinning is processed until each remaining pixel has only two 4-neighbours set to 1 in the ouput binary image. The last thinning steps involve reducing the neighbourhood to 8-connexity.

The second method used for this algorithm was proposed by Zhang and Suen [1], in which each pass is decomposed by 2 sub-iterations.

For a single passs, a pixel $ I[x, y] $ can be deleted if its 3x3 neighbouhood respects the conditions :

The algorithm is faster than the default approach and the output skeletons are smoother than the ones obtained by the default algorithm, with less branches. It is therefore more robust to border variations but can yield coarser approximations and missing information. The results are similar than the skeletonize function provided by the skimage python module with default parameters.

See also
https://scikit-image.org/docs/dev/api/skimage.morphology.html#skimage.morphology.skeletonize

Here is the result of the skeleton operation applied to a binary image. We can clearly notice the difference between the default algorithm (left) and the algorithm proposed by [1] :

skeleton2dImg.png

[1] Zhang, T. Y. and Suen, C. Y., "A fast parallel algorithm for thinning digital patterns", Communications of the ACM, March 1984, Volume 27, Number 3.

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.skeleton2dImg(inImg)

Example of C++ code :

Example informations

Header file

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

Code Example

// opening input image
ImagePtr pInBinImg = loadTiffImageFile(inputImgPath);
// compute skeletons on input image
ImagePtr pOutImg = skeleton2dImg(pInBinImg);