1 | initial version |
I'm not sure to understand your question.
You cannot set initial centers in k-means. But you can set initial labels. It means that if you know intial labels then you know initial centers. You can do like this :
2 | No.2 Revision |
I'm not sure to understand your question.
You cannot set initial centers in k-means. But you can set initial labels. It means that if you know intial labels then you know initial centers. You can do like this :
I think you can use this sample : replace Mat points(sampleCount, 1, CV_32FC2), labels; by Mat points(sampleCount, 1, CV_32FC2), labels(sampleCount, 1,CV_32SC1); and in loop
label.rowRange(k*sampleCount/clusterCount, k == clusterCount - 1 ? sampleCount :(k+1)*sampleCount/clusterCount) =k;
I haven't tested..