How to adjust image size in GUI
2 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
Adam
2015 年 1 月 9 日
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 件のコメント
Adam
2015 年 1 月 9 日
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.
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!