OpenCV's clustering function cvKMeans2() - why doesnt work when i use the centers parameter
问题 i use this code. its should print the clusters labels an then the centroids. but the 'center"matrix with the centriod seems to be empty,full of zeros. what is wrong my friends? #include <iostream> #include <stdio.h> #include "cxcore.h" #include "highgui.h" using namespace cv; int main( int argc, char** argv ) { int i,j; CvMat* points = cvCreateMat( 5, 2, CV_32FC1 ); CvMat* centers2 = cvCreateMat( 5, 2, CV_32FC1 ); CvMat* clusters = cvCreateMat( 5, 1, CV_32SC1 ); cvSetReal2D( points, 0, 0,1);