Adding a title to a roipoly image

7 visualizaciones (últimos 30 días)
Victoria
Victoria el 15 de Mayo de 2013
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 comentario
Sulimon Sattari
Sulimon Sattari el 15 de Mayo de 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')

Iniciar sesión para comentar.

Respuestas (1)

Image Analyst
Image Analyst el 16 de Mayo de 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 comentarios
Victoria
Victoria el 20 de Mayo de 2013
The idea was to keep the message from disappearing when I run roipoly. Is there a way to do that?
Image Analyst
Image Analyst el 20 de Mayo de 2013
Not that I'm aware of. You could use a static text label instead of using the title. That would probably stick around.

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by