Color Clustering for Object Detection
Version 1.0.1 (1.21 KB) by
Samiran Deori
This code will perform Color Clustering on input image.
% I = imread function to read an image from storage
% And using imshow function display the image on which
% color clustering and object detection is to be
% performed.
% For input k = [1 2 3 4 5 6] , K-means clustering is performed on input image
% For performing k = 6 iterations one for loop is
% used.
% To perform K means clustering based image
% segmentation imsegkmeans function is used to get
% the centers of each cluster and indexes of each
% cluster.
% To reshape the array from column to an M*N matrix, % reshape function is used.
% To show it as a color cluster image, labeloverlay
% function is used.
% For each k = ith value color clustering is being
% performed on the image and is being displayed using % imshow function for each ith iteration
Cite As
Samiran Deori (2025). Color Clustering for Object Detection (https://www.mathworks.com/matlabcentral/fileexchange/102449-color-clustering-for-object-detection), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Created with
R2021b
Compatible with any release
Platform Compatibility
Windows macOS LinuxTags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.