Kmeans algorithm stops without exception
Hi everyone,
I'm using OpenCV 2.4.3 in Ubuntu (12.10) in the following way:
Mat points = Mat(total_rows, 128, CV_32F, descritores);
Mat labels;
int clusterCount = k;
int dimensions = points.cols;
int sampleCount = points.rows;
int num_iterations = 2;
Mat centers(clusterCount, 128, CV_32F/*points.type()*/);
kmeans(points, clusterCount, labels, TermCriteria(CV_TERMCRIT_EPS + CV_TERMCRIT_ITER, num_iterations, 1.0), 10, KMEANS_PP_CENTERS, centers);
But suddenly the program stops when it is executing kmeans, without showing an exception or error. Descritores is a float pointer, and I verified that points is being initialized in a correct way. Points.cols = 128 and points.rows = 950173. My pc has 16 GB of ram, so I don't think is a memory problem. Could you please help me to understand the error? Is there any limit to the size of the data kmeans can handle? If some more details are needed, just ask me. Thanks.
I did a kmeans with more than 1M rows, so this should not be an issue. Did you try debugging step by step to see where the program exits?
I debugged the code and the problem occurs in the line 2659 of the file matrix.cpp: box[j] = Vec2f(sample[j], sample[j]);
I don't understand why it is not working. These are the values of some variables in the kmeans function: N = 950173 isrow = false dims = 128 type = 5 attempts = 10 criteria.type = 3 criteria.epsilon = 1 criteria.maxCount = 100
Is the type (data.depth()) wrong? If it is the case, how can I proceed in order to get rid of this error?
Thanks in advance.