image = | fillHole2dImg (inBinImg) |
holes filling in a binary 2d image
This algorithm allows to fill holes inside connected components in an input binary image InBinImg with respect to a given neighborhood 2d policy (see 2d neighborhood models).
Two versions of this algorithm are implemented which can be selected using attribute InOptOptimizationPolicy which associated to enumerate ipsdk::imaproc::attr::eProcessingOptimizationPolicy :
- a 'fast' version using a binary and a label intermediate image (which can optionally be provided via OutOptWk1BinImg and OutOptWk1LabelImg attributes)
- a low memory consumption iterative algorithm which propagate reconstructed elements until convergence.
Here is an example of hole filling algorithm on an image 2d :
Example of Python code :
Example imports
import PyIPSDK
import PyIPSDK.IPSDKIPLAdvancedMorphology as advmorpho
Code Example
inBinImg = PyIPSDK.loadTiffImageFile(inputImgPath)
outImg = advmorpho.fillHole2dImg(inBinImg)
Example of C++ code :
Example informations
Header file
#include <IPSDKIPL/IPSDKIPLAdvancedMorphology/Processor/FillHole2dImg/FillHole2dImg.h>
Code Example
ImagePtr pOutImg = fillHole2dImg(pInBinImg);