Adaptive kmeans Clustering for Color and Gray Image.

Automatically cluster a Color or Gray image. No need for specify number of cluster.
Updated 29 Apr 2014

View License

This algorithm is a fully automatic way to cluster an input Color or gray image using kmeans principle, but here you do not need to specify number of clusters or any initial seed value to start iteration, this algorithm automatically finds number of cluster and cluster center iteratively. It is a very fast implementation of clustering an image without knowing number of clusters.
1. Cluster a Gray(single channel(0-255)) or Color image(3 channel(0-255)) as in kmeans.
2. Not need to be specify number of cluster for clustering.
3. Very Fast implementation.
4. Very Easy to understand.
5. Easy to Modify the code according to your requirements.
6. No use of any Image Processing Tool Function.
This code uses same principle as in kmeans, but here you do not need to define number of clusters.

You can use this code to estimate the number of clusters(colors) present in image, this code may not be segment all images as you want, so post processing of clustered image is suggested.

Please review it after download, I am waiting for your suggestions and modifications.

Thank You,
Ankit Dixit

Cite As

ankit dixit (2024). Adaptive kmeans Clustering for Color and Gray Image. (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2012b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes

description change

Description edited.

Supports color image clustering

Now also supports Color Images(R G B) for clustering.