-1

I've created a kmeans cluster that I mostly want to be able to display clearly. I'm trying to add the cenrtoid location for each of the cluster indeces. Right now the result is something like this: current cluster

It is a 24576x3 size matrix I ran kmeans on and reshaped into a 128x192 matrix:

ClusterFigure = reshape(kmeans(ClusterData, 12), [128 192]);
imagesc(ClusterFigure);

I was hoping there's a way to display the cetroids within this presentation comfortably. Perhaps some kind of symbol where each specific index's centroid would be or something. Anyone has any ideas?

Has QUIT--Anony-Mousse
  • 76,138
  • 12
  • 138
  • 194
Zvi Baratz
  • 21
  • 8
  • 1
    can you give a rough idea of what exactly do you want your figure to look like? Also can you give the code you used to generate the current figure. – GameOfThrows Dec 07 '15 at 09:42

1 Answers1

0

I would question whether the cluster centroids are really that relevant considering that the cluster values within your blob are pretty disperse.

If you really want to display the cluster centroids you'll probably have to calculate them manually as the centroids given by kmeans assume a 1D vector, which is not the case here. You want something like

for i=1:no_clusters
[y, x]=find(img==i);
cy(i)=mean(y);
cx(i)=mean(x);
end

The I would just plot the centroids on your image using a small cross for clarity and probably putting each one in a different colour.

nivag
  • 573
  • 2
  • 8