White Dots Counting & Coloring on Dice using K-means Clustering Algorithm

Опубликовано: 17 Июль 2026
на канале: Knowledge Amplifier
694
19

Prerequisite:
Clearing border components
   • Clearing border components | Digital Image...  
Region filling In-Built Function
   • Region filling In-Built Function | Digital...  
Morphological Opening
   • Object Decomposition using Morphological O...  
Mall Customer Segmentation using k-means Clustering | Machine Learning | MATLAB
   • Mall Customer Segmentation using k-means C...  

Code:

clc
clear all
close all
warning off
x=rgb2gray(imread('Project.JPG'));
imshow(x);
g=imbinarize(x);
figure;
imshow(g);
ms=imclearborder(g);
figure;
imshow(ms);
BW=imfill(ms,'holes');
BW=imopen(BW,strel('disk',5));
figure;
imshow(BW);
s=regionprops(BW,'Centroid');
centroid=[];
for i=1:length(s)
centroid=[centroid;s(i).Centroid];
end
idx=kmeans(centroid,5,'Replicates',10);
imshow(x);
hold on;
gscatter(centroid(:,1),centroid(:,2),idx,'rgbmy',[],40);



Learn Complete Machine Learning & Data Science using MATLAB:
   • Data Science & Machine Learning using MATLAB  

Learn Digital Signal Processing using MATLAB:
   • Digital Signal Processing Matlab  

Learn Complete Image Processing & Computer Vision using MATLAB:
   • Digital Image Processing using MATLAB  

🙏🙏🙏🙏🙏🙏🙏🙏
YOU JUST NEED TO DO
3 THINGS to support my channel
LIKE
SHARE
&
SUBSCRIBE
TO MY YOUTUBE CHANNEL


#kmeans #MATLAB #MachineLearning #DataScience #ImageProcessing #ComputerVision