I was going the K-means algorithm as a technique for clustering images, as part of my project in the area of Image Processing. In the process, I decided to code using OpenCV libraries. So, can somebody help me in coding the algorithm in C++ using OpenCV. I can manage well, if some code snippet is provided. I just started learning about the OpenCV environment. Thank you for reading this. I ll be grateful for your help. waiting for a reply!
Before you implement clustering (k-means or otherwise), you need to figure out how to compare one image vs the other. This is usually dependent on the type of images you have, what features you can extract (colors, edges, shapes etc.).
A simple way of comparing 2 images would be to use the SURF features and compare to other images' SURF features. The OpenCV samples should get you started on how to extract SURF.
Other approaches would be to extract edges, shapes, color histograms and compare to others. Once you have done so, clustering should be fairly straightforward.
Check mlem.cpp and cxmatrix.cpp.
If you're new to OpenCV, have a look at my website.. http://aishack.in/ I've put up some tutorials/articles on vision and vision algorithms. Hopefully they'll help!