Home > Objects > @iData > kmeans.m



[b,c] = kmeans(X, k) : k-means clustering of iData object


function [s,c] = kmeans(a, k, method)


 [b,c] = kmeans(X, k) : k-means clustering of iData object

   @iData/kmeans function to partition the object X into k classes.

   b = kmeans(a,k) partitions the points in the iData object X into k clusters.
     The resulting object Signal contains numbers from 1 to 'k' which are indices
     of segments/partitions.
     When no cluster can be found, the result is empty.
   b = kmeans(a) assumes k=2 partitions
   [b,c] = kmeans(a,k) also returns the centroid of the clusters/partitions/segments.

 input:  X: object or array (iData)
         k: number of partitions wanted (integer, default is 2)
         method: '' for default, 'otsu' for Otsu method (only for 2D images).
 output: b: object or array with partition indices (iData)
         c: centroid locations of clusters
 ex:     b=kmeans(a);

 See: http://en.wikipedia.org/wiki/K-means_clustering
 See: https://en.wikipedia.org/wiki/Otsu%27s_method
 Reference: Otsu N., A threshold selection method from gray-level histogram, IEEE Trans. Syst. Man Cybern. 9:62-66;1979

 Version: Aug. 22, 2017
 See also iData, iData/uminus, iData/abs, iData/real, iData/imag, iData/uplus


This function calls: This function is called by:
Generated on Tue 22-Aug-2017 11:03:30 by m2html © 2005. iFit (c) E.Farhi/ILL EUPL 1.1