How to See Each Formulate Numbers on Regionprops

1 回表示 (過去 30 日間)
Murat Kocaman
Murat Kocaman 2018 年 6 月 29 日
回答済み: Ameer Hamza 2018 年 6 月 29 日
Hello,
I have below code for regionprops. I would like to see "Area" value for each object for my image. There are n object but entering the s(k).Area it gives random object's area. I tried s(k).Area(n), as well but this time it gives nth object's value. I would like to see the area for each object in the result.
s=regionprops(logical(bw3),'Centroid','Area','Eccentricity','Perimeter');
hold on
for k=1:numel(s)
c=s(k).Centroid;
text(c(1),c(2),sprintf('%d',k),...
'HorizontalAlignment','center',...
'VerticalAlignment','middle');
end
hold off
What is the solution?

採用された回答

Ameer Hamza
Ameer Hamza 2018 年 6 月 29 日
The following will give you a vector of all area values
areaValues = [s.Area];
concatenation operator [] is important.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Segmentation and Analysis についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by