Load and display image when pushing a button

12 visualizaciones (últimos 30 días)
Matteo Gambaurtti
Matteo Gambaurtti el 9 de Dic. de 2017
Comentada: Mohammad Sami el 17 de Mzo. de 2020
I'm looking for help with the creation of a GUI in MATLAB. When the user pushes a button, the program should load an image and display it.
I tried many suggestions found on this forum with no luck.
Here the portion of my code:
% Button pushed function: BrowseButton
function BrowseButtonPushed(app, event)
[FileName,PathName] = uigetfile({'*.jpeg;*.png';'*.*'},'Select an image to process');
FullPath = strcat(PathName,FileName);
app.PathEditField.Value = FullPath;
app.PathEditField.HorizontalAlignment = 'right';
% I = imread(FullPath);
% J = imresize(I, 0.08);
imshow(FullPath,'Parent',app.AcquiredImg);
end
The image should be loaded in AXES called "AcquiredImg" which is inside a panel.
Any suggestion? Thank you!
  3 comentarios
Fareha Chowdhury
Fareha Chowdhury el 16 de Mzo. de 2020
did this code work?
Mohammad Sami
Mohammad Sami el 17 de Mzo. de 2020
You are using strcat. use the function fullfile(directory,fname) to get the fullpath.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Interactive Control and Callbacks en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by