How to adjust image size in GUI
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi! I'm solving this problem in Matlab GUI
I'm trying to show to images in the same uipanel one over another for example first image is apple and second image is contour of apple so second image should be displayed over the first.
I'm using this code
I=imread('apple.gif');
plot(handles.uipanel2);
imshow(double(I), 'InitialMagnification', 'fit');
hold on;
plot(Contour(:,2),Contour(:,1),'r');
Problem is the size of image and it is showen outside the uipanel and the image is huge
How can I show it inside the uipanel with smaller size?
0 comentarios
Respuesta aceptada
Adam
el 9 de En. de 2015
An image must be plotted on an axes. You can place an axes on the panel and then put the image on the axes and it will then remain bounded by however large you make the axes within the panel.
plot(handles.uipanel2);
does not make sense though as you cannot plot directly onto a panel. By default it will create a new axes on the current figure which is why your image sits centrally within the figure containing the panel rather than in the panel itself.
3 comentarios
Adam
el 9 de En. de 2015
subplot creates the axes on the parent panel. Your imshow instruction just plots on whatever happens to be the current axes. Because there isn't one it creates one in the current figure by default.
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!