Clustering and Search in Multi-Dimensional Spaces


KMeans2(samples, nclusters, labels, termcrit) → None

Splits set of vectors by a given number of clusters.

  • samples (CvArr) – Floating-point matrix of input samples, one row per sample
  • nclusters (int) – Number of clusters to split the set by
  • labels (CvArr) – Output integer vector storing cluster indices for every sample
  • termcrit (CvTermCriteria) – Specifies maximum number of iterations and/or accuracy (distance the centers can move by between subsequent iterations)

The function cvKMeans2 implements a k-means algorithm that finds the centers of nclusters clusters and groups the input samples around the clusters. On output, \texttt{labels}_i contains a cluster index for samples stored in the i-th row of the samples matrix.

Table Of Contents

Previous topic

XML/YAML Persistence

Next topic

Utility and System Functions and Macros

This Page