How to adjust TEXT in "regionprops" ?
3 ビュー (過去 30 日間)
古いコメントを表示
I am using "regionprops" with "Perimeter" property. The following outcome I have achieved:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/969105/image.png)
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.
0 件のコメント
採用された回答
Matt J
2022 年 4 月 19 日
編集済み: Matt J
2022 年 4 月 19 日
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 件のコメント
その他の回答 (1 件)
Image Analyst
2022 年 4 月 19 日
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/969175/image.png)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Get Started with MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!