How to adjust TEXT in "regionprops" ?

조회 수: 2 (최근 30일)
Abdul Hannan Qureshi
Abdul Hannan Qureshi 2022년 4월 19일
편집: Abdul Hannan Qureshi 2022년 4월 19일
I am using "regionprops" with "Perimeter" property. The following outcome I have achieved:
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.

채택된 답변

Matt J
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
Abdul Hannan Qureshi
Abdul Hannan Qureshi 2022년 4월 19일
편집: Abdul Hannan Qureshi 2022년 4월 19일
I apologize, I dont have programming background, so missed that technical aspect. Thank you for correcting me.
Issue resolved.
Thanks.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Image Analyst
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.

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by