How do I display an image that a user uploads?

์กฐํšŒ ์ˆ˜: 2 (์ตœ๊ทผ 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 Exchange์—์„œ Migrate GUIDE Apps์— ๋Œ€ํ•ด ์ž์„ธํžˆ ์•Œ์•„๋ณด๊ธฐ

์ œํ’ˆ


๋ฆด๋ฆฌ์Šค

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by