k means clustering, error

1 Ansicht (letzte 30 Tage)
Tomas
Tomas am 15 Mär. 2014
Kommentiert: Image Analyst am 16 Mär. 2014
im = imread('hestain.png');
im=rgb2gray(im) //if you only want grayscale intensities
[idx centroids]=kmeans(double(im(:)),4);
??? Error using ==> kmeans>batchUpdate at 436
Empty cluster created at iteration 1.
Error in ==> kmeans at 337
converged = batchUpdate();
Error in ==> Untitled2 at 5
[idx centroids]=kmeans(double(im(:)),4);
Does anyone help ?
Thanks.

Antworten (2)

Walter Roberson
Walter Roberson am 15 Mär. 2014
Look at the documentation page, at the 'emptyaction' option.

Image Analyst
Image Analyst am 15 Mär. 2014
Evidently you've adapted the demo at this web page to your image incorrectly. You don't have clusters because you don't have a second axis. You just passed in a 1D vector. What is the other axis that you think you have that forms clusters?
  6 Kommentare
Tomas
Tomas am 15 Mär. 2014
ok, Thank you for your time and help.
I have to use clustering methods.
My graduation theses is about cluster analysis.
Image Analyst
Image Analyst am 16 Mär. 2014
Then you must know more about it than me. So again I ask you what are the two measures, what are the two axes that something is going to be plotted against, if you're not going to use the locations (rows, columns) like I derived for you? And if you do use those, then there's no need to classify because the classification was done first in order to get the coordinates.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Agriculture finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by