Clustering function OpenCV cvKMeans2 () - what type of cluster center in the array?

I am using the cvKMeans2 () function from the OpenCV library for clustering. It has an optional parameter:
centers - Optional output array of cluster centers
The same parameter is also in the kmeans () function.

I want to know cluster information. But I did not find what the type of cluster center in the array is, so I can not get it.

Thanks for any tips!

+7
c ++ opencv cluster-analysis k-means
source share
3 answers

In OpenCV 2.0, the equivalent kmeans function accepts the CV_32FC1 matrix, but OpenCV 2.0 is a pretty significant upgrade to the old kmeans2 function, so I cannot be sure that the cluster data type will still be the same for OpenCV 1.1.

+2
source share

This shows that the β€œcenters” parameter is of the same type as the first parameter, which the other documentation says:

The CvArr metatype is used only as a parameter of a function to indicate that the function sometimes accepts arrays of several types, such as IplImage *, CvMat *, or even CvSeq *. A specific array type is determined at runtime by parsing the first 4 bytes of the header.

Which, combined with this question , makes me think that you should try passing a CV array (vector) to get the centers.

+1
source share

All Articles