フィルターのクリア

GUI Resize Image, but not updating in axes

4 ビュー (過去 30 日間)
jake stan
jake stan 2018 年 4 月 28 日
コメント済み: Walter Roberson 2018 年 4 月 28 日
I'm trying to resize an image, but the image itself within the axes stays the same in the gui no matter what scale factor I input
function upload_Callback(hObject, eventdata, handles)
% hObject handle to upload (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[File, Path] = uigetfile({'*.*';'*.jpg';'*.png';'*.bmp'}, 'Image to be displayed');
filename = [Path, File];
image = imread(filename);
axes(handles.imgframe);
hold off
resize(filename, 4);
function resize(file, factor)
//Above all resize code did not include in the question
//figure();
imshow(img1_nearest);
end
my resize function works on its on when I put it in to a figure, but I'm trying to put the resize image back to the axes to display it. The image size is the same no matter what scale factor I put
  2 件のコメント
jake stan
jake stan 2018 年 4 月 28 日
Oh I'm not trying to put it on to a figure, I want it to be resized on the GUI when I push a button

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2018 年 4 月 28 日
編集済み: Walter Roberson 2018 年 4 月 28 日
imshow() only automatically resizes the figure if the current axes is in the "default" position that would occur if the axes were the only thing in the figure.
imshow() never resizes just an axes by itself.
If you want to fit an axes around an image, then set the InnerPosition to be the same size as image (watch out that X is columns not rows), and set the axes DataAspectRatio to [1 1 1]. This will probably leave a gap around the axes for small images, and will probably cause the axes to overlap your other controls if you display a large enough image.
  2 件のコメント
jake stan
jake stan 2018 年 4 月 28 日
Oh I don't see any property to change the inner position axes, do you mean outerposition?
Walter Roberson
Walter Roberson 2018 年 4 月 28 日

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDisplay Image についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by