Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenCV's clustering function cvKMeans2() - what is a type of cluster center in array?

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

I want to know informations about clusters. But I haven't found what is a type of that cluster center in array, so I can't get it.

Thanks for any advices!

like image 545
Naomak Avatar asked Jan 16 '10 22:01

Naomak


People also ask

What is cluster centers in KMeans?

Introducing k-Means The "cluster center" is the arithmetic mean of all the points belonging to the cluster. Each point is closer to its own cluster center than to other cluster centers.

How do you find the cluster centroid?

To calculate the centroid from the cluster table just get the position of all points of a single cluster, sum them up and divide by the number of points.

Which clustering is an example of centroid model?

k-means is the most widely-used centroid-based clustering algorithm. Centroid-based algorithms are efficient but sensitive to initial conditions and outliers. This course focuses on k-means because it is an efficient, effective, and simple clustering algorithm. Figure 1: Example of centroid-based clustering.

How do you identify a cluster?

Clusters are identified by applying a mathematical algorithm that assigns vertices (i.e., users) to subgroups of relatively more connected groups of vertices in the network. The Clauset-Newman-Moore algorithm [8], used in NodeXL, enables you to analyze large network datasets to efficiently find subgroups.


2 Answers

In OpenCV 2.0, the equivalent kmeans function takes a CV_32FC1 matrix, but OpenCV 2.0 is quite a substantial upgrade to the old kmeans2 function, so I cannot be sure if the cluster centers datatype would still be the same for the OpenCV 1.1 version.

like image 165
Ray Hidayat Avatar answered Oct 05 '22 10:10

Ray Hidayat


This makes it look like the "centers" parameter has the same type as the first parameter, which other documentation says:

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

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

like image 33
John Zwinck Avatar answered Oct 05 '22 10:10

John Zwinck