mirror of https://github.com/opencv/opencv.git
Open Source Computer Vision Library
https://opencv.org/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1.2 KiB
60 lines
1.2 KiB
Clustering |
|
========== |
|
|
|
.. highlight:: python |
|
|
|
|
|
|
|
.. index:: KMeans2 |
|
|
|
.. _KMeans2: |
|
|
|
KMeans2 |
|
------- |
|
|
|
`id=0.682106387651 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/py/core/KMeans2>`__ |
|
|
|
|
|
.. function:: KMeans2(samples,nclusters,labels,termcrit)-> None |
|
|
|
Splits set of vectors by a given number of clusters. |
|
|
|
|
|
|
|
|
|
|
|
|
|
:param samples: Floating-point matrix of input samples, one row per sample |
|
|
|
:type samples: :class:`CvArr` |
|
|
|
|
|
:param nclusters: Number of clusters to split the set by |
|
|
|
:type nclusters: int |
|
|
|
|
|
:param labels: Output integer vector storing cluster indices for every sample |
|
|
|
:type labels: :class:`CvArr` |
|
|
|
|
|
:param termcrit: Specifies maximum number of iterations and/or accuracy (distance the centers can move by between subsequent iterations) |
|
|
|
:type termcrit: :class:`CvTermCriteria` |
|
|
|
|
|
|
|
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, |
|
:math:`\texttt{labels}_i` |
|
contains a cluster index for |
|
samples stored in the i-th row of the |
|
``samples`` |
|
matrix. |
|
|
|
|