Adding a title to a roipoly image
조회 수: 7 (최근 30일)
이전 댓글 표시
I'd like to put a title or caption on the figure displayed by the roipoly function so that users know what to do when the image comes up. I haven't been able to do it with any title method I know of for regular figures and graphs, and every search I've done has turned up completely empty. Is there a way to do this, or does MATLAB not support it?
댓글 수: 1
Sulimon Sattari
2013년 5월 15일
What version of MATLAB are you running? This worked fine for me in R2012a
I = imread('eight.tif');
c = [222 272 300 270 221 194];
r = [21 21 75 121 121 75];
BW = roipoly(I,c,r);
figure, imshow(I)
figure, imshow(BW)
figure(2)
title('hello')
figure(1)
title('hello1')
답변 (1개)
Image Analyst
2013년 5월 16일
Do not pass the image to roipoly(). Use text() or title() to put up instructions. Also you may want to consider roipolyold() - a more streamlined version that doesn't require confirmation. Try this:
fontSize = 16;
I = imread('eight.tif');
imshow(I);
% Enlarge figure to full screen.
set(gcf, 'units','normalized','outerposition',[0 0 1 1]);
message = sprintf('Click the vertices.\nRight click to finish and close polygon.\nDouble-click inside polygon to accept it.');
% Display instructions as title.
title(message, 'FontSize', fontSize);
text(10,10,message);
uiwait(msgbox(message));
% Unfortunately everything disappears when you run roipoly.
BW = roipoly();
subplot(1, 2, 1);
imshow(I)
subplot(1, 2, 2);
imshow(BW)
댓글 수: 2
Image Analyst
2013년 5월 20일
Not that I'm aware of. You could use a static text label instead of using the title. That would probably stick around.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!