IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit

function for computing super pixels More...

IPSDKIPLADVANCEDMORPHOLOGY_API image::ImagePtr ipsdk::imaproc::advmorpho::superPixels2dImg (const image::ImageConstPtr &pInImg, const ipUInt32 inSuperPixelsParamValue, const ipReal32 inCompactness, const ipUInt32 inNbIter)
 wrapper function for Super pixels algorithm based on SLIC More...
 
IPSDKIPLADVANCEDMORPHOLOGY_API image::ImagePtr ipsdk::imaproc::advmorpho::superPixels2dImg (const image::ImageConstPtr &pInImg, const ipUInt32 inSuperPixelsParamValue, const ipReal32 inCompactness, const ipUInt32 inNbIter, const ipReal32 inOptSizeRatio, const ipsdk::imaproc::attr::eSuperPixelsType &pInOptSuperPixelsType)
 wrapper function for Super pixels algorithm based on SLIC More...
 
IPSDKIPLADVANCEDMORPHOLOGY_API void ipsdk::imaproc::advmorpho::superPixels2dImg (const image::ImageConstPtr &pInImg, const ipUInt32 inSuperPixelsParamValue, const ipReal32 inCompactness, const ipUInt32 inNbIter, const image::ImagePtr &pOutLabelImg)
 wrapper function for Super pixels algorithm based on SLIC More...
 
IPSDKIPLADVANCEDMORPHOLOGY_API void ipsdk::imaproc::advmorpho::superPixels2dImg (const image::ImageConstPtr &pInImg, const ipUInt32 inSuperPixelsParamValue, const ipReal32 inCompactness, const ipUInt32 inNbIter, const ipReal32 inOptSizeRatio, const ipsdk::imaproc::attr::eSuperPixelsType &pInOptSuperPixelsType, const image::ImagePtr &pOutLabelImg)
 wrapper function for Super pixels algorithm based on SLIC More...
 

Detailed Description

function for computing super pixels

The super pixels 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 pixels (group of pixels). Those super pixels are computed to follow the contours of the input image. Each pixel is compared with the center of the closest super pixels, and associated to the most similar one, in term of distance and color.

The following parameters allow to optimise the computation of the super pixels:

Here is an example (number of super pixels : 500, compactness : 0.5, number of iterations : 3, size ratio : 0.5)

superPixels2dImg.png

Attributes description

Attribute description for algorithm :

Name ToolTip Default Initializer
ipsdk::imaproc::attr::InImg [Input] image for processing operation X
ipsdk::imaproc::attr::InSuperPixelsParamValue [Input] Value used to initialize super pixels (number or size) X
ipsdk::imaproc::attr::InNbIter [Input] Number of iterations for an iterative algorithm X
ipsdk::imaproc::attr::InCompactness [Input] Ratio between distance and color for super pixels algorithm X
ipsdk::imaproc::attr::InOptSizeRatio [Input Optional] Ratio to compare a size with a reference X
ipsdk::imaproc::attr::InOptSuperPixelsType [Input Optional] Type of input parameter for super pixels algorithm (number of super pixels or size) X
ipsdk::imaproc::attr::OutWk1Img [Output] Temporary working image for algorithm duplicateInOut (_pOutWk1Img, _pInImg, ipsdk::image::eImageBufferType::eIBT_Real32)
ipsdk::imaproc::attr::OutWk1LabelImg [Output] Temporary working image for algorithm duplicateGreyInOut (_pOutWk1LabelImg, _pInImg, ipsdk::image::eImageBufferType::eIBT_Label32)
ipsdk::imaproc::attr::OutLabelImg [Output] label image for processing operation duplicateGreyInOut (_pOutLabelImg, _pInImg, ipsdk::image::eImageBufferType::eIBT_Label32)

Global Rule description

Global rule description for algorithm :
ipsdk::imaproc::matchSize (eMatchImageSizeType::eMIST_XYZT,_pInImg,_pOutLabelImg)

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLAdvancedMorphology as advmorpho

Code Example

# opening of input image
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
# Optional parameters
superPixelsNumber = 500
compactness = 0.5
nbIter = 3
sizeRatio = 0.5
superPixelsType = PyIPSDK.eSPT_Number
outImg = advmorpho.superPixels2dImg(inImg, superPixelsNumber, compactness, nbIter, sizeRatio,superPixelsType)

Example of C++ code :

Example informations

Associated library

IPSDKIPLAdvancedMorphology

Header file

Code Example

ImagePtr pInImg = loadTiffImageFile(inputImgPath);
ImagePtr pOutBinLabImg = superPixels2dImg(pInImg, 500,0.5,3);
See also
SuperPixels2dImgLvl1
SuperPixels2dImgLvl2
SuperPixels2dImgLvl3

Function Documentation

◆ superPixels2dImg() [1/4]

IPSDKIPLADVANCEDMORPHOLOGY_API image::ImagePtr ipsdk::imaproc::advmorpho::superPixels2dImg ( const image::ImageConstPtr pInImg,
const ipUInt32  inSuperPixelsParamValue,
const ipReal32  inCompactness,
const ipUInt32  inNbIter 
)

wrapper function for Super pixels algorithm based on SLIC

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ superPixels2dImg() [2/4]

IPSDKIPLADVANCEDMORPHOLOGY_API image::ImagePtr ipsdk::imaproc::advmorpho::superPixels2dImg ( const image::ImageConstPtr pInImg,
const ipUInt32  inSuperPixelsParamValue,
const ipReal32  inCompactness,
const ipUInt32  inNbIter,
const ipReal32  inOptSizeRatio,
const ipsdk::imaproc::attr::eSuperPixelsType pInOptSuperPixelsType 
)

wrapper function for Super pixels algorithm based on SLIC

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ superPixels2dImg() [3/4]

IPSDKIPLADVANCEDMORPHOLOGY_API void ipsdk::imaproc::advmorpho::superPixels2dImg ( const image::ImageConstPtr pInImg,
const ipUInt32  inSuperPixelsParamValue,
const ipReal32  inCompactness,
const ipUInt32  inNbIter,
const image::ImagePtr pOutLabelImg 
)

wrapper function for Super pixels algorithm based on SLIC

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ superPixels2dImg() [4/4]

IPSDKIPLADVANCEDMORPHOLOGY_API void ipsdk::imaproc::advmorpho::superPixels2dImg ( const image::ImageConstPtr pInImg,
const ipUInt32  inSuperPixelsParamValue,
const ipReal32  inCompactness,
const ipUInt32  inNbIter,
const ipReal32  inOptSizeRatio,
const ipsdk::imaproc::attr::eSuperPixelsType pInOptSuperPixelsType,
const image::ImagePtr pOutLabelImg 
)

wrapper function for Super pixels algorithm based on SLIC

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure