Updated by Alexander Shishkov almost 13 years ago

The CvEM [[CvEM]] training procedure crashes for some data queries because the initial cluster estimation with kmeans may return empty clusters. Consequently, not all clusters will be used by EM. In the best cases, we just end up with some clusters at the origin without a crash, sometimes however, the whole program dies.

To remedy this bug, you simply have to change line 870 in file modules/ml/src/em.cpp from:

cvKMeans2(temp_mat, nclusters, labels, termcrit, 10);

to:

cvKMeans2(temp_mat, nclusters, labels, termcrit, 10, 0, cv::KMEANS_PP_CENTERS);

That's all - then it should work fine.

Have a nice day,
Richard

Back