implements k-means algorithm that finds centers of cluster_count clusters and groups the input samples around the clusters. On output labels(i) contains a cluster index for sample stored in the i-th row of samples matrix

C# | Visual Basic | Visual C++ |
public static void cvKMeans2( IntPtr samples, int cluster_count, IntPtr labels, MCvTermCriteria termcrit )
Public Shared Sub cvKMeans2 ( _ samples As IntPtr, _ cluster_count As Integer, _ labels As IntPtr, _ termcrit As MCvTermCriteria _ )
public: static void cvKMeans2( IntPtr samples, int cluster_count, IntPtr labels, MCvTermCriteria termcrit )

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