1 | initial version |
unfortunately, opencv can't help you much here. (there's cv::partition(), but you can't use it from python)
have a look at scikit, DBSCAN should be close to what you want. in general, you need an algorithm, where you can specify a distance (function), not the desired number of clusters.