Borrar filtros
Borrar filtros

Image segmentation using k means clustering

1 visualización (últimos 30 días)
Penny13
Penny13 el 4 de Abr. de 2018
Comentada: Image Analyst el 22 de Dic. de 2019
Hello, I have a question and I appreciate your help. I don't know how to use a kmeans clustering results in image segmentation. I have an RGB image of a tissue which has 5 colors for 5 biomarkers and I need to do k means clustering to segment every color in a cluster. Thank you so much for your help.

Respuesta aceptada

Image Analyst
Image Analyst el 20 de Dic. de 2018
Editada: Image Analyst el 20 de Dic. de 2018
I'm attaching a color kmeans demo that doesn't require a recent version of the stats toolbox or image processing toolbox.
Personally I don't think kmeans works that great (perhaps because it's untrained), as you'll probably see, and you might try a trained discriminant analysis instead. I attach demos for both.
  1 comentario
Penny13
Penny13 el 21 de Dic. de 2018
Thank you so much Image Analyst. I will try both to see what would be the results.

Iniciar sesión para comentar.

Más respuestas (1)

Walter Roberson
Walter Roberson el 4 de Abr. de 2018
If you have 5 biomarkers then you would need to segment to a minimum of 6 clusters: one for each marker and one for tissue that is not one of the biomarkers. kmeans always assigns a cluster to every point, so if you had a point that was not one of the 5 colors and you asked to cluster it, then it would assign it to one of the five anyhow.
Note that the index values returned by kmeans are not in any pre-set order. You cannot assume that index 1 is associated with biomarker color #1. It is common for clusters to change effective identities during processing, so even if you had specified initial cluster centers in the options you passed to kmeans, you should not assume that the numbering of the output will be the same as the order of the initial cluster centers.
Remember too that a cluster centroid can be outside of data that belongs to that cluster. For example consider a perfect unfilled semi-circle of points: its centroid is the centre of the circle but no data points are at that center. You therefore cannot just index the centroid location into the image and look at the pixel value there to figure out what is happening.
  14 comentarios
SRUTHI BANDI
SRUTHI BANDI el 22 de Dic. de 2019
Error in demo1 (line 16)
[cluster_idx, cluster_center] = kmeans(ab,nColors,'distance','sqEuclidean', ...
error comes like this
Image Analyst
Image Analyst el 22 de Dic. de 2019
An error like what? You forgot to give the actual error message.
I just copied and pasted and ran it again successfully.
Are you sure you have the Stats toolbox?

Iniciar sesión para comentar.

Community Treasure Hunt

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

Start Hunting!

Translated by