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 vues (au cours des 30 derniers jours)
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;

Réponses (2)

Walter Roberson
Walter Roberson le 6 Mai 2017
Modifié(e) : Walter Roberson le 6 Mai 2017
text(centroid(i,1), centroid(i,2), num2str(b));

basak kandoker
basak kandoker le 6 Mai 2017
thanks a lot

Catégories

En savoir plus sur Strategy & Logic dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by