Modify group label image - kmeans
1 view (last 30 days)
Show older comments
I have an image on which i have performed kmeans to segment objects (red circles). The lowest number of clusters that was able to segment the circles that i require was 5. Now, i want to modify the group label image so that it has only 2 groups: one for the circles and the other for the rest of the image. How may i do this?
This is how i found that k=5 segments the image best:
E = imread('earthquakes1.jpg');
X=reshape(E,size(E,1)*size(E,2),size(E,3));
K=[2 3 4 5];
for i = 1:4
[Layer,Centers] = kmeans(double(X),K(i));
Y = reshape(Layer,size(E,1),size(E,2));
B = labeloverlay(E,Y);
subplot (2,2,i);
imshow(B) ;
caption = sprintf('K = %d',i+1);
title(caption);
end
0 Comments
Accepted Answer
Image Analyst
on 12 Mar 2022
Edited: Image Analyst
on 12 Mar 2022
I don't understand. Is that image the one called 'earthquakes1.jpg' -- and does it have the red circles already in it? Or is 'earthquakes1.jpg' the map image alone, but with red circles that you plotted over it in the overlay? If you plotted the red circles, you already know their coordinates.
If the circles are burned into the image you can find them with normalized cross correlation (demo attached) or with the Color Thresholder app on the Apps tab of the tool ribbon. However you will have trouble finding red blobs as separate circles if the circles are greatly overlapped.
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!