ingenuitas/SimpleCV — pull request #261 by vijaym123 (2012-12-07 18:02:58+00:00)
Title: Kmeans clustering of blobs

Hi Kat,

So far i have implemented clustering of blobs in a feature set using K-Means. Here are some results i wish to show.

Code snippet :
```python
img = Image("lenna")
blobs = img.findBlobs()
clusters = blobs.cluster(method="kmeans",k=5,properties=["color"])
for i in clusters:
i.draw(color=Color.getRandom(),width=5)
img.show()
```

I have chosen k = 3 for experimental purpose.

* Clustering blobs based on color
![Clustering based on color](http://i.imgur.com/xwZmh.png)

*Clustering blobs based on shape
![Clustering based on shape](http://i.imgur.com/Dvso4.png)

*Clustering blobs based on position
![Clustering based on position](http://i.imgur.com/JUdoQ.png)

I don't know if the results are correct. What do you say? Do i need to test it on some other image? If so, can you suggest? :)

For the Hierarchical clustering, according to the theory yes, it automagically determines K. But in the [scikit learn docs](http://scikit-learn.org/stable/tutorial/statistical_inference/unsupervised_learning.html#hierarchical-agglomerative-clustering-ward), it is mentioned that we need to provide the number of clusters! Any inputs?

Regards,
Vijay Mahantesh SM