Color Clustering for Object Detection

This code will perform Color Clustering on input image.
56 Downloads
Updated 21 Nov 2021

View License

% 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