i found object's areas with regionprops but i cant show them on image? i can plot centroidds but i cant text areas. please help me
11 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I=propsSynthesizeImage;
figure,imshow(I);
[B,L]=bwboundaries(I,'noholes');
figure,imshow(L);
area=regionprops(L,'area');
areas=cat(1,area.Area);
s=regionprops(L,'centroid');
centroids=cat(1,s.Centroid);
centroid=round(centroids);
imshow(label2rgb(L,@jet,[.7 .7 .7]));
hold on
plot(centroids(:,1),centroids(:,2),'r+');
s2=regionprops(L,'MajorAxisLength');
s2=cat(1,s2.MajorAxisLength);
s2=round(max(s2));
for k=1:length(B);
boundary=B{k};
plot(boundary(:,2),boundary(:,1),'w','LineWidth',2);
plot(s2);
end
for i=1:length(areas);
b=areas(i,1);
text(centroid(i,1),centroid(i,2),'b');
end
hold off;
0 comentarios
Respuestas (2)
Walter Roberson
el 6 de Mayo de 2017
Editada: Walter Roberson
el 6 de Mayo de 2017
text(centroid(i,1), centroid(i,2), num2str(b));
0 comentarios
basak kandoker
el 6 de Mayo de 2017
1 comentario
Walter Roberson
el 6 de Mayo de 2017
(I corrected it.. I keep putting in str2num instead of num2str)
Ver también
Categorías
Más información sobre Strategy & Logic 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!