image = | superVoxels3dImg (inImg,inSuperPixelsParamValue,inCompactness,inNbIter) |
image = | superVoxels3dImg (inImg,inSuperPixelsParamValue,inCompactness,inNbIter,inOptSizeRatio,inOptSuperPixelsType) |
function for computing super voxels
The super voxels algorithm is based on the SILC method (Simple Linear Iterative Clustering)
- See also
- https://darshita1405.medium.com/superpixels-and-slic-6b2d8a6e4f08
This algorithm is used to separate an image into super voxels (group of voxels). Those super voxels are computed to follow the contours of the input image. Each voxel is compared with the center of the closest super voxels, and associated to the most similar one, in term of distance and color.
The following parameters allow to optimise the computation of the super voxels:
is the desired number of super voxels, or the desired size of the super voxels, depending on the value of
.
is the ratio between the euclidian distance and the color distance, used to classify a voxel in his corresponding super voxels. With a small value, the super voxels will fit the contours better, and with a high value, the super voxels will be more regular. Advised values are around 0.5.
is the number of iterations used in the algorithm. At the end of each iteration, the center of each super voxel is updated for the next iteration.
is the minimal size of a super voxel (as a fraction of their supposed size). If a super voxel is smaller, it will be removed and replaced by the neighboring super voxels. Default value is 0.5.
define if the first parameter
is the desired number of super voxels, or the desired size of the super voxels. Default value is "Number".
For simplest visualization, an example of super pixels computation is illustrated in Super Pixels 2d.
Example of Python code :
Example imports
import PyIPSDK
import PyIPSDK.IPSDKIPLAdvancedMorphology as advmorpho
Code Example
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
superPixelsNumber = 500
compactness = 0.5
nbIter = 3
sizeRatio = 0.5
superPixelsType = PyIPSDK.eSPT_Number
outImg = advmorpho.superVoxels3dImg(inImg, superPixelsNumber, compactness, nbIter, sizeRatio, superPixelsType)
Example of C++ code :
Example informations
Header file
#include <IPSDKIPL/IPSDKIPLAdvancedMorphology/Processor/SuperVoxels3dImg/SuperVoxels3dImg.h>
Code Example
ImagePtr pOutBinLabImg = superVoxels3dImg(pInImg, 500, 0.5, 3);