How to print regionprops properties on image?

4 visualizaciones (últimos 30 días)
sacprasanna
sacprasanna el 7 de Dic. de 2015
Editada: Walter Roberson el 7 de Dic. de 2015
Dear All,
I want to print each labeled region area on the image it self? I calculated label matrix and regionprops matrix using area.
g=regionprops(LB,'Area');
>> g(19)
ans =
Area: 166
Then I want to print these area on image it self. (pixel width is 0.07).
Like this picture.
Thanks for helping
Regards
Chamara

Respuesta aceptada

Walter Roberson
Walter Roberson el 7 de Dic. de 2015
Editada: Walter Roberson el 7 de Dic. de 2015
Does the label need to go in the image, or can it go over the image?
If it can go over the image, then as well as asking for the regionprops Area, also ask for the Centroid, and then text() the Area to the location given by the Centroid. text() will draw over the image.
If you need to create a new image that has the text "burned in" then if you have the Computer Vision Toolbox then there is a insertText() function, or you can use the older Vision.TextInserter for now.
  1 comentario
sacprasanna
sacprasanna el 7 de Dic. de 2015
Editada: Walter Roberson el 7 de Dic. de 2015
Thanks Walter, I want code over the image. I rewrite code according to your tip.
Pro=regionprops(Lb,'Area','Centroid');
figure,imshow(Original),
for cnt = 2:length(Pro)
text(Pro(cnt).Centroid(1),Pro(cnt).Centroid(2),num2str(Pro(cnt).Area*0.07*0.07),'FontSize',5,'color','red');
end

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Computer Vision with Simulink en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by