Is it possible to numerically label a segmented image?

1 visualización (últimos 30 días)
Diondra
Diondra el 23 de Jun. de 2015
Editada: Adam Danz el 13 de Dic. de 2019
I've written some code to segment, count, and analyze the properties of bacterial colonies in a petri dish. Now, I would like to use principal component analysis to visualize the diversity of bacterial strains present in a given sample. My current method yields the PCA and plots 2 components against each other and even allows me to identify outlier points by number; however, I currently have no way of knowing which colony in my image actually corresponds to number "112" for example. Does anyone know of a way to overlay the colony numbers onto the original image so that I can have a reference point to make sense of the PCA data? I've attached my code if that's helpful.
Thank you in advance!
  1 comentario
Adam Danz
Adam Danz el 23 de Jun. de 2015
Editada: Adam Danz el 13 de Dic. de 2019
Hello Katalin, if you have the x,y coordinates of the colonies, you can use labelpoints.m found in the file exchange. This function labels large groups of points like this:
and it has an optional outlier parameter that will only label the outliers. But this won't be helpful if you don't have vectors of X,Y values.

Iniciar sesión para comentar.

Respuesta aceptada

Katalin
Katalin el 23 de Jun. de 2015
Hello! Try this:
M = im2uint8(label/NUM);
imshow(M)
s = regionprops(M, 'Centroid');
hold on
for k = 1:numel(s)
c = s(k).Centroid;
text(c(1), c(2), sprintf('%d', k), ...
'HorizontalAlignment', 'center', ...
'VerticalAlignment', 'middle', 'Color', 'red', 'fontsize',12);
end
hold off

Más respuestas (0)

Categorías

Más información sobre Particle Swarm en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by