Borrar filtros
Borrar filtros

How to cluster rows of a matrix and label them

5 visualizaciones (últimos 30 días)
Pushkar Khatri
Pushkar Khatri el 19 de Dic. de 2018
Respondida: Image Analyst el 19 de Dic. de 2018
I have to convexify Kmeans clustering. So I'll be using some modified functions. I want to know how do I label my modified image matrix(80000x3 double) and form clusters and initialise the cluster centres by taking the mean of the cluster formed(I have to make sure that the initailised cluster centres lie within the data points) . (Generally, cluster centres are generated randomly initially.) Please help with the code.
I = im2double(imread('hest.png'));
F =reshape(I,size(I,1)*size(I,2),3);
K = 5; % # of cluster
U = F( ceil(rand(K,1)*size(F,1)) ,:);% random cluster centres generated

Respuestas (1)

Image Analyst
Image Analyst el 19 de Dic. de 2018
See my attached demo to do kmeans clustering on an RGB image. Adapt as needed.
Generally kmeans gives a crummy segmentation with color images. You might try discriminant analysis instead (demo also attached). It seems to do better.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by