How to adjust TEXT in "regionprops" ?

2 visualizaciones (últimos 30 días)
Abdul Hannan Qureshi
Abdul Hannan Qureshi el 19 de Abr. de 2022
Editada: Abdul Hannan Qureshi el 19 de Abr. de 2022
I am using "regionprops" with "Perimeter" property. The following outcome I have achieved:
How I can move these texts below each related white line and add unit to it, i.e., 283.04 cm.
Mentioned below is the used code:
j=regionprops(binaryImage,'Perimeter','Centroid');
score= ([j.Perimeter]/(2*3.7));
figure, imshow(binaryImage);
for cnt = 1:length(j)
text(j(cnt).Centroid(1),j(cnt).Centroid(2),num2str(score(cnt)),'FontSize',12,'color','red');
end
Kindly guide.

Respuesta aceptada

Matt J
Matt J el 19 de Abr. de 2022
Editada: Matt J el 19 de Abr. de 2022
The question doesn't seem to have anything to do with regionprops really, just with your call to text().
morespace=5;
figure, imshow(binaryImage);
for cnt = 1:length(j)
text(j(cnt).Centroid(1),j(cnt).Centroid(2)+morespace,...
num2str(score(cnt))+" cm",'FontSize',12,'color','red');
end
  1 comentario
Abdul Hannan Qureshi
Abdul Hannan Qureshi el 19 de Abr. de 2022
Editada: Abdul Hannan Qureshi el 19 de Abr. de 2022
I apologize, I dont have programming background, so missed that technical aspect. Thank you for correcting me.
Issue resolved.
Thanks.

Iniciar sesión para comentar.

Más respuestas (1)

Image Analyst
Image Analyst el 19 de Abr. de 2022
For what it's worth, see the attached demo. It explains how the blobs are numbered (labeled), which is a confusing topic for many people.

Categorías

Más información sobre Get Started with MATLAB en Help Center y File Exchange.

Productos


Versión

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by