필터 지우기
필터 지우기

Can I display the value of a variable onto an image?

조회 수: 8 (최근 30일)
JayJay
JayJay 2018년 7월 31일
답변: JayJay 2018년 7월 31일
I=imread('cameraman.tif');
BW=roipoly(I);
c=bwarea(BW)
I want the value of c to show up on my figure. For eg, if the area (c) = 30, I want the text 'Area=30' to show up on the figure of the cameraman.tif image. Is this possible?

채택된 답변

Image Analyst
Image Analyst 2018년 7월 31일
Do this:
caption = sprintf('Area = %f', c);
text(10, 10, caption, 'FontSize', 30);

추가 답변 (2개)

Jan
Jan 2018년 7월 31일
Should it appear in the figure, or do you want to insert it in the saved image file? Both is possible.
  댓글 수: 1
JayJay
JayJay 2018년 7월 31일
I want it to appear on the figure. I've attached a sample image which is how I want it to look

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


JayJay
JayJay 2018년 7월 31일
Thank You!

Community Treasure Hunt

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

Start Hunting!

Translated by