func KMeans(data *Mat, k int, termcrit TermCriteria, attempts int, rng RNG, flags int) (labels, centers *Mat) {
	var compactness C.double

	labels = CreateMat(data.Rows(), 1, CV_32S)
	centers = CreateMat(k, 1, data.Type())

	C.cvKMeans2(
		unsafe.Pointer(data),
		C.int(k),
		unsafe.Pointer(labels),
		(C.CvTermCriteria)(termcrit),
		C.int(attempts),
		(*C.CvRNG)(&rng),
		C.int(flags),
		unsafe.Pointer(centers),
		&compactness)

	return labels, centers
}
func KMeans(data *Mat, k int, termcrit TermCriteria, attempts int, rng RNG, flags int) (labels, centers *Mat) {
	var compactness C.double

	labels = CreateMat(data.Rows(), 1, CV_32S)
	centers = CreateMat(k, 1, data.Type())

	C.cvKMeans2(
		unsafe.Pointer(data),
		C.int(k),
		unsafe.Pointer(labels),
		(C.CvTermCriteria)(termcrit),
		C.int(attempts),
		(*C.CvRNG)(&rng),
		C.int(flags),
		unsafe.Pointer(centers),
		&compactness)

	return labels, centers
}
/*
KMeans finds centers of k clusters in data and groups input samples around
the clusters. It returns a matrix that stores the cluster indices for every
sample, and a matrix that stores the cluster centers.
*/