Adding a title to a roipoly image
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaire
Sulimon Sattari
le 15 Mai 2013
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')
Réponses (1)
Image Analyst
le 16 Mai 2013
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 commentaires
Image Analyst
le 20 Mai 2013
Not that I'm aware of. You could use a static text label instead of using the title. That would probably stick around.
Voir également
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!