Borrar filtros
Borrar filtros

Solving K-means issue

1 visualización (últimos 30 días)
Lab Rat
Lab Rat el 24 de Nov. de 2012
Hi,
I'm trying to use K-means to segment and image and then working on the resulting mask to clean it up, but K-means doesn't seem to give a fixed output everytime the script is executed so I'm not able to work on the resulting images correctly. How do I ensure that the output remains the same everytime ?

Respuestas (2)

Image Analyst
Image Analyst el 24 de Nov. de 2012
It should, unless you've varied something, like the image you're processing, or the initial set of means. Does your script ask the user for any input (like filename, etc.), or use any random numbers?
  2 comentarios
Lab Rat
Lab Rat el 24 de Nov. de 2012
No, I'm not changing anything. Not even the input image. It just keeps changing when I run the script. . The final mask keeps interchanging between black and white. Sometimes the foreground is white while at other times it is black with the same thing with the background.
Image Analyst
Image Analyst el 24 de Nov. de 2012
Are you using some code or function from the Statistics Toolbox? I don't have that but if you edit your question to include it then maybe someone can reproduce it. Use a standard demo image that everybody has (because it ships with MATLAB) if you can.

Iniciar sesión para comentar.


Walter Roberson
Walter Roberson el 24 de Nov. de 2012
The k-means algorithm involves random cluster initialization unless you provide initial cluster centers.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by