IPSDK 0.2
IPSDK : Image Processing Software Development Kit
Remove small shape 2dSee full documentation
imageremoveSmallShape2dImg (inBinLabImg,inMinShapeSize)

Detailed Description

removal of small connected component in binary or label 2d image

This algorithm allows to remove connected components into a binary or label 2d input image associated to a number of pixels lower than a given input threshold value InMinShapeSize.

Output result image OutImg has same type as input image InBinLabImg. This means that an input binary image will produce an output binary image and that an input label image will produce an output label image. Note that in label case, input labels index are reordered to fill index list holes created by shape filtering.

Here is an example of small connected component removal on an image 2d :

removeSmallShape2dImg.png

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLAdvancedMorphology as advmorpho

Code Example

# opening of input image
inBinImg = PyIPSDK.loadTiffImageFile(inputImgPath)
# connected component analysis
labImg = advmorpho.connectedComponent2dImg(inBinImg)
# compute small shape removal on input image
# note: algorithm can also be used with input binary image
outImg = advmorpho.removeSmallShape2dImg(labImg, 500)

Example of C++ code :

Example informations

Header file

#include <IPSDKIPL/IPSDKIPLAdvancedMorphology/Processor/RemoveSmallShape2dImg/RemoveSmallShape2dImg.h>

Code Example

// opening input image
ImagePtr pInBinImg = loadTiffImageFile(inputImgPath);
// compute small shape removal on input image
// note: algorithm can also be used with input label image
ImagePtr pOutImg = removeSmallShape2dImg(pInBinImg, 500);