abcd12
abcd12

Reputation: 1

Different results for opencv c++ kmeans and matlab kmeans

MATLAB K-means gives accurate results for an image, whereas k-means with OpenCV c++ does not give the same result, even though parameters are same. Is there any difference in implementation?

Upvotes: 0

Views: 191

Answers (2)

Olivier Sohn
Olivier Sohn

Reputation: 1322

Matlab's kmeans function uses kmeans++ by default, and kmeans++ can be activated in cv::kmeans through the KMEANS_PP_CENTERS flag.

Upvotes: 1

tenta4
tenta4

Reputation: 312

Wikipedia says that method randomly chooses k-observations from the data set and uses these as the initial means. And the result may depend on the initial clusters

That's why results may differ even within OpenCV methods execution, especially for Matlab

Upvotes: 0

Related Questions