image block clustering using kmeans

Hi all.
I have block from an image obtained using:
How best can I cluster similar blocks from my BlockImage matrix using: kmeans?
I also wish to display the distance between; any two intra-cluster blocks, any two blocks from different clusters; any two centroids if possible.
Honestly, am not so sure how to tackle this. Looking at the kmeans examples from the document, is not so intuitive for this particular scenario.
Thanks alot.

 Respuesta aceptada

Image Analyst
Image Analyst el 21 de Feb. de 2022

0 votos

6 comentarios

MatlabEnthusiast
MatlabEnthusiast el 21 de Feb. de 2022
@Image Analyst thanks. Let me look into them. The reason is I want to cluster blocks.
Image Analyst
Image Analyst el 21 de Feb. de 2022
How is this different than just getting a class for every pixel in the image?
MatlabEnthusiast
MatlabEnthusiast el 21 de Feb. de 2022
Editada: MatlabEnthusiast el 21 de Feb. de 2022
because, I already generated the distinct blocks with pre determined dimensions. So clustering over blocks, I can easily tell how many blocks are in a cluster(hopefully) - thats the aim. Maybe even play with the individual blocks see their effect on the image.
Image Analyst
Image Analyst el 21 de Feb. de 2022
Editada: Image Analyst el 21 de Feb. de 2022
Maybe this is why I never use im2col(). Explain to me what's going on here:
grayImage = imread('moon.tif');
[rows, columns, numberOfColorChannels] = size(grayImage)
rows = 537
columns = 358
numberOfColorChannels = 1
subplot(1, 2, 1);
imshow(grayImage);
axis on
m = rows;
n = 8;
BlockImage = im2col(grayImage,[m n],'distinct');
subplot(1, 2, 2);
imshow(BlockImage);
axis on
MatlabEnthusiast
MatlabEnthusiast el 21 de Feb. de 2022
you converted the distinct image blocks to a column matrix?
MatlabEnthusiast
MatlabEnthusiast el 22 de Feb. de 2022
but seriously whats happening?

Iniciar sesión para comentar.

Más respuestas (0)

Preguntada:

el 21 de Feb. de 2022

Comentada:

el 22 de Feb. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by