pub fn kmeans(data: &dyn core::ToInputArray, k: i32, best_labels: &mut dyn core::ToInputOutputArray, criteria: core::TermCriteria, attempts: i32, flags: i32, centers: &mut dyn core::ToOutputArray) -> Result<f64> {
	input_array_arg!(data);
	input_output_array_arg!(best_labels);
	output_array_arg!(centers);
	unsafe { sys::cv_kmeans_const__InputArrayX_int_const__InputOutputArrayX_TermCriteria_int_int_const__OutputArrayX(data.as_raw__InputArray(), k, best_labels.as_raw__InputOutputArray(), &criteria, attempts, flags, centers.as_raw__OutputArray()) }.into_result()
}
/// Finds centers of clusters and groups input samples around the clusters.
/// 
/// The function kmeans implements a k-means algorithm that finds the centers of cluster_count clusters
/// and groups the input samples around the clusters. As an output, ![inline formula](https://latex.codecogs.com/png.latex?%5Ctexttt%7BbestLabels%7D%5Fi) contains a
/// 0-based cluster index for the sample stored in the ![inline formula](https://latex.codecogs.com/png.latex?i%5E%7Bth%7D) row of the samples matrix.
/// 
/// 
/// Note:
/// *   (Python) An example on K-means clustering can be found at
///    opencv_source_code/samples/python/kmeans.py
/// ## Parameters
/// * data: Data for clustering. An array of N-Dimensional points with float coordinates is needed.
/// Examples of this array can be:
/// *   Mat points(count, 2, CV_32F);
/// *   Mat points(count, 1, CV_32FC2);
/// *   Mat points(1, count, CV_32FC2);
/// *   std::vector\<cv::Point2f\> points(sampleCount);
/// * K: Number of clusters to split the set by.
/// * bestLabels: Input/output integer array that stores the cluster indices for every sample.
/// * criteria: The algorithm termination criteria, that is, the maximum number of iterations and/or
/// the desired accuracy. The accuracy is specified as criteria.epsilon. As soon as each of the cluster
/// centers moves by less than criteria.epsilon on some iteration, the algorithm stops.
/// * attempts: Flag to specify the number of times the algorithm is executed using different
/// initial labellings. The algorithm returns the labels that yield the best compactness (see the last
/// function parameter).
/// * flags: Flag that can take values of cv::KmeansFlags
/// * centers: Output matrix of the cluster centers, one row per each cluster center.
/// ## Returns
/// The function returns the compactness measure that is computed as
/// ![block formula](https://latex.codecogs.com/png.latex?%5Csum%20%5Fi%20%20%5C%7C%20%5Ctexttt%7Bsamples%7D%20%5Fi%20%2D%20%20%5Ctexttt%7Bcenters%7D%20%5F%7B%20%5Ctexttt%7Blabels%7D%20%5Fi%7D%20%5C%7C%20%5E2)
/// after every attempt. The best (minimum) value is chosen and the corresponding labels and the
/// compactness value are returned by the function. Basically, you can use only the core of the
/// function, set the number of attempts to 1, initialize labels each time using a custom algorithm,
/// pass them with the ( flags = #KMEANS_USE_INITIAL_LABELS ) flag, and then choose the best
/// (most-compact) clustering.
/// 
/// ## C++ default parameters
/// * centers: noArray()
Finds centers of clusters and groups input samples around the clusters.
The function kmeans implements a k-means algorithm that finds the centers of cluster_count clusters
and groups the input samples around the clusters. As an output, ![inline formula] contains a
0-based cluster index for the sample stored in the ![inline formula] row of the samples matrix.

(Python) An example on K-means clustering can be found at
opencv_source_code/samples/python/kmeans.py
Finds centers of clusters and groups input samples around the clusters . The function kmeans implements a k - means algorithm that finds the centers of cluster_count clusters and groups the input samples around the clusters . As an output ! [ inline formula ] contains a 0 - based cluster index for the sample stored in the ! [ inline formula ] row of the samples matrix . ( Python ) An example on K - means clustering can be found at opencv_source_code / samples / python / kmeans . py
pub fn kmeans(data: &dyn core::ToInputArray, k: i32, best_labels: &mut dyn core::ToInputOutputArray, criteria: core::TermCriteria, attempts: i32, flags: i32, centers: &mut dyn core::ToOutputArray) -> Result<f64> {
	input_array_arg!(data);
	input_output_array_arg!(best_labels);
	output_array_arg!(centers);
	unsafe { sys::cv_kmeans_const__InputArrayX_int_const__InputOutputArrayX_TermCriteria_int_int_const__OutputArrayX(data.as_raw__InputArray(), k, best_labels.as_raw__InputOutputArray(), &criteria, attempts, flags, centers.as_raw__OutputArray()) }.into_result()
}
pub fn kmeans ( data : & dyn core :: ToInputArray , k : i32 , best_labels : & mut dyn core :: ToInputOutputArray , criteria : core :: TermCriteria , attempts : i32 , flags : i32 , centers : & mut dyn core :: ToOutputArray ) -> Result < f64 > { input_array_arg ! ( data ) ; input_output_array_arg ! ( best_labels ) ; output_array_arg ! ( centers ) ; unsafe { sys :: cv_kmeans_const__InputArrayX_int_const__InputOutputArrayX_TermCriteria_int_int_const__OutputArrayX ( data . as_raw__InputArray ( ) , k , best_labels . as_raw__InputOutputArray ( ) , & criteria , attempts , flags , centers . as_raw__OutputArray ( ) ) } . into_result ( ) }
Finds centers of clusters and groups input samples around the clusters.
Finds centers of clusters and groups input samples around the clusters .
The function returns the compactness measure that is computed as
[block formula]
after every attempt. The best (minimum) value is chosen and the corresponding labels and the
compactness value are returned by the function. Basically, you can use only the core of the
function, set the number of attempts to 1, initialize labels each time using a custom algorithm,
pass them with the ( flags = #KMEANS_USE_INITIAL_LABELS ) flag, and then choose the best
(most-compact) clustering.
The function returns the compactness measure that is computed as [ block formula ] after every attempt . The best ( minimum ) value is chosen and the corresponding labels and the compactness value are returned by the function . Basically you can use only the core of the function set the number of attempts to 1 initialize labels each time using a custom algorithm pass them with the ( flags = #KMEANS_USE_INITIAL_LABELS ) flag and then choose the best ( most - compact ) clustering .
data
&dyn core::ToInputArray
k
i32
best_labels
&mut dyn core::ToInputOutputArray
criteria
core::TermCriteria
attempts
i32
flags
i32
centers
&mut dyn core::ToOutputArray
c++ default parameters
None