kmeans cluster radius
Hi, I have discovered kmeans, and am using it like this:
Mat labels, centers;
int attempts = 50, clusterCount = 4, flags = cv::KMEANS_PP_CENTERS;
TermCriteria tc;
kmeans(centroids, clusterCount, labels, tc, attempts, flags, centers);
BUT, as it will run in a video stream, the number of clusters that i want will change as it picks up more points of interest. Is there a way to use radius from cluster centre to search instead of number of clusters?
thanks.
I think you should start by what are you trying to do, maybe there is some other approaches that fit better than kmeans...
Hi, I am trying to identify the separate clusters in images like this :
http://i58.tinypic.com/wwdw0l.jpg
So that I end up with this:
http://i59.tinypic.com/2dm9gtl.jpg
Yesterday someone suggested kmeans, which works on the still frame, but when it is a video stream, the number of clusters needs to change automatically.
So applying the kmeans on each frame is "wrong" because you have set clusterCount to 4? You'll need some sort of detector for the number of clusters...
exactly. I need a function that will find a new cluster as it appears in frame, and make it a new cluster.
Is kMeans not what i need for this? Or would i use it in conjunction with something else? What sort of detector would you recommend?
thanks for your help
Have you seen this? Have you done it in another way? Why do you want to change it? Maybe applying kmeans in a loop and detecting the best number of clusters is the way; but maybe this is not going to be fast enough.
thanks! I am unsure how to detect the best number of clusters. Will read through that wiki again and try to understand it... Possibly kMeans is not what i want though, as clusters will be constantly in and out of frame.
Is there any other function that searches for clustering in a similar way, or would you suggest another approach?
Maybe adjusting number of clusters based on the standard deviation in each cluster if you do a kmeans with clusterCount+1 and clusterCount-1?
This may help too
sorted. using the 'rule of thumb' from that wiki page, then looping and adding one each time. thanks for your help!
...obviously will only work if all clusters are the same size.