フィルターのクリア

How do I display an image that a user uploads?

4 ビュー (過去 30 日間)
Shelby
Shelby 2024 年 2 月 6 日
編集済み: Walter Roberson 2024 年 2 月 7 日
I am building an app that take's an image that a user inputs and scans it using OCR for specific words. I want the user to upload an image and then display it on my app. Could someone help me figure out where I'm going wrong? This is my current code:
function UploadFileButtonPushed(app, event)
[filename, pathname] = uigetfile({'*.png;*.jpg;*.jpeg;*.bmp', 'Image Files (*.png, *.jpg, *.jpeg, *.bmp)'}, 'Select an Image');
image = imread(fullfile(pathname, filename));
imshow(image, 'Parent', app.ImageAxes);
end
  2 件のコメント
Anton Kogios
Anton Kogios 2024 年 2 月 6 日
The code you are using should work (see attached app). Are you sure app.ImageAxes.Visible is set to 'on'?
You could also try this instead of imshow:
imagesc(app.UIAxes,image);
Shelby
Shelby 2024 年 2 月 7 日
Thank you so much! That fixed the problem. I was just using the wrong "Axes" term.

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

採用された回答

Anton Kogios
Anton Kogios 2024 年 2 月 7 日
I'm glad it worked out for you! Just adding my comment as an answer so you can accept it 🙂
The code you are using should work (see attached app in above comment). Are you sure app.ImageAxes.Visible is set to 'on'?
You could also try this instead of imshow:
imagesc(app.UIAxes,image);

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by