I use the following call to openCV function to perform K-means algorithm:
cvKMeans2(points, count, &clusters, cvTermCriteria( CV_TERMCRIT_EPS+CV_TERMCRIT_ITER, 10, 1.0 ), 1, CV_KMEANS_USE_INITIAL_LABELS, centers);
where
image2 = cvLoadImage( "lab.jpg", 0);
points = cvCreateMat( image2->height, image2->width, CV_32FC1 );
cvConvert(image2, points);
//count= number of clusters.
CvMat* centers; // To store the center of each cluster. (output).
lab.jpg is an image in CIE L*a*b* format.
But the above line, while compiling, shows the following errors:
`CV_KMEANS_USE_INITIAL_LABELS' undeclared (first use in this function)
too many arguments to function `cvKMeans2'
It would be very helpful if someone can point out where am wrong, specially the first error which says KMEANS_USE_INITIAL_LABELS undeclared.
Thanks in advance !
From the opencv doc for
cvKMeans2:You left out CV_.
Edit: also note that there should be two arguments between
termcritandflags, so you are skipping eitherattemptsorrng. Try