IPSDK 0.2
IPSDK : Image Processing Software Development Kit
Kernel K-means assignmentSee full documentation
imagekernelKMeansAssignImg (inImg,inKKMeansCentroids)

Detailed Description

assignment part of Kernel based KMeans clustering algorithm

This algorithm used results from a Kernel K-means algorithm (Kernel K-means algorithm) to classify some new data. This can be seen as the second part of a classical training/assignment clustering process.

Given an input sequence image $InHomogeneousImg$ of size {x, y, z, c, t}, with c the number of color channels and t the number of elements in temporal sequence, the algorithm will assign a cluster index to each pixels of the output classes image $OutClassImg$. Assignments are computed with respect to input Kernel centroids parameter $InKKMeansCentroids$.

Here is an example of Kernel K-means assignment process where the left part of an input image is used as 'training data' generating centroids coordinates and the right part is then assigned to cluster indices using these centroids coordinates :

KernelKMeansAssignImg.png

Example of Python code :

Example imports

Code Example

Example of C++ code :

Example informations

Header file

#include <IPSDKIPL/IPSDKIPLClassification/Processor/KernelKMeansAssignImg/KernelKMeansAssignImg.h>

Code Example

// opening input image
ImagePtr pInImg = loadTiffImageFile(inputImgPath);
// retrieve left half part and right half part of image
ImagePtr pLeftInImg = getROI2dImg(pInImg, 0, 0, pInImg->getSizeX() / 2, pInImg->getSizeY());
ImagePtr pRightInImg = getROI2dImg(pInImg, pInImg->getSizeX() / 2, 0, pInImg->getSizeX() / 2, pInImg->getSizeY());
// computation of Kernel KMeans clustering on left image part
// (this is then considered as a training step)
const ipUInt32 nbSamples = 5000;
KernelKMeansResults resLeft = kernelKMeansImg(pLeftInImg, nbClusters, nbSamples);
// computation of assignments on right image part from previous trained
// cluster centroids
ImagePtr pOutRightImg = kernelKMeansAssignImg(pRightInImg, resLeft._pClustersCentroids);