k means clustering using k=4

1 visualización (últimos 30 días)
vijeta uppal
vijeta uppal el 29 de Mzo. de 2021
Comentada: Walter Roberson el 29 de Mzo. de 2021
Perform K-means clustering on the mandrill image with K=4.
can someone please help me with code for this question, as I'm a begineer don't have much idea about how to proceed with this question.

Respuesta aceptada

KSSV
KSSV el 29 de Mzo. de 2021
I = imread('Mandril.jpeg') ;
I = im2double(I);
R = I(:,:,1); R = R(:);
G = I(:,:,2); G = G(:);
B = I(:,:,3); B = B(:);
idx = kmeans([R G B], 4);
imshow(ind2rgb(reshape(idx, size(I,1), size(I, 2)), rand(4,3)))
  1 comentario
Walter Roberson
Walter Roberson el 29 de Mzo. de 2021
Note that it was a homework question...

Iniciar sesión para comentar.

Más respuestas (1)

Walter Roberson
Walter Roberson el 29 de Mzo. de 2021
The line that has
[idx,C] = kmeans(X,3);
would change to
[idx,C] = kmeans(X,4);
if you were clustering with four clusters.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by