algorithm, based on watershed, allowing to separate binary 2d shapes
This algorithm, based on distance map and watershed algorithms, allows to separate shapes of an input binary image.
Given an input binary image InBinImg, algorithm process following steps :
- Distance map computation (see Distance Map 2d) which allows to define area of influence for each shape.
- Dilation of local maxima on distance map (see Dilate Local Extrema 2d). This step can be customized using parameter InDilateFactor which allows to merge local maxima.
- Separation of shapes using watershed algorithm (see Seeded Watershed 2d). This step can be customized using parameters InOptWatershedProcMode and InOptNbMinDataByThread.
Global output of a algorithm can be customized using parameter InWatershedSeparationMode which can take following values :
- ipsdk::imaproc::attr::eWatershedSeparationMode::eWSM_Split (in this case OutBinLabImg is a binary image)
- ipsdk::imaproc::attr::eWatershedSeparationMode::eWSM_Lines (in this case OutBinLabImg is a binary image)
- ipsdk::imaproc::attr::eWatershedSeparationMode::eWSM_Basins (in this case OutBinLabImg is a label image)
Example of Python code :
Example imports
import PyIPSDK
import PyIPSDK.IPSDKIPLAdvancedMorphology as advmorpho
import PyIPSDK.IPSDKIPLBinarization as bin
Code Example
inGreyImg = PyIPSDK.loadTiffImageFile(inputGreyImgPath)
inBinImg = bin.thresholdImg(inGreyImg, 75, 255)
outImg = advmorpho.watershedBinarySeparation2dImg(inBinImg, 5,
PyIPSDK.eWatershedSeparationMode.eWSM_Split)
Example of C++ code :
Example informations
Header file
#include <IPSDKIPL/IPSDKIPLAdvancedMorphology/Processor/WatershedBinarySeparation2dImg/WatershedBinarySeparation2dImg.h>
Code Example