how to display multiple images in matlab gui axes one by one

10 visualizaciones (últimos 30 días)
asif
asif el 18 de Abr. de 2014
Comentada: Walter Roberson el 11 de Dic. de 2017
in a gui of axes and two push buttons, i have to display multiple images in axes and to view them one by one using those buttons named next and back.like a slide show.

Respuestas (4)

Sonalika
Sonalika el 27 de Abr. de 2014
1. The opening function:
handles.output = hObject;
filelist=dir(fullfile('C:\Users\Sonalika\Documents\MATLAB\test\*.jpg'));
handles.filelist = filelist;
handles.frameindex = 1;
% Update handles structure
guidata(hObject, handles);
2. pushbutton function:
function load_frame_Callback(hObject, eventdata, handles)
axes(handles.axes1);
filelist = handles.filelist;
frameindex = handles.frameindex;
myfolder='C:\Users\Sonalika\Documents\MATLAB\test';
currentframefile = filelist(frameindex).name;
handles.frameindex = frameindex+1;
ff=fullfile(myfolder,currentframefile);
I=imread(ff);
imshow(I);
guidata(hObject, handles);
All the Best!
  3 comentarios
Sonalika
Sonalika el 27 de Abr. de 2014
I agree that the list box is much more convenient, but since he asked that particular question let's give him that! My answer actually is not creating a list, its a function on the pushbutton so that every time you press it, it goes to next image. Just like he wanted. A similar func for decreasing has to be created.
I was actually doing this for my program but when I saw ur list suggestion I'm doing that instead. So you did help someone at least! Thanks! :)
Image Analyst
Image Analyst el 28 de Abr. de 2014
Oh, you're right. I just saw the word list and I thought you had a listbox, but I can see that you actually don't because nowhere do you set the string property of a listbox control. You're just storing the whole list of filenames and the current "index" in fields attached to the global "handles" variable when you start up the program, and then using those in the "Next" and "Last" pushbutton callbacks.. That should work.

Iniciar sesión para comentar.


Image Analyst
Image Analyst el 18 de Abr. de 2014
Not very easy to use or user friendly at all. Why not use a listbox like most programs, where the user can see the filenames and click on whatever file in whatever order they want, like in this framework : http://www.mathworks.com/matlabcentral/fileexchange/24224-magic-matlab-generic-imaging-component
  15 comentarios
asif
asif el 20 de Abr. de 2014
is there any other alternative to view multiple images one by one.
Image Analyst
Image Analyst el 20 de Abr. de 2014
Yes, you could use a popup that you loaded with all the filenames, just like you'd do with the listbox. Or you could use a push button and call uigetfile() to let the user browse every time. None are as user friendly as a listbox, but if you want to torture your users, you could use one of those methods.

Iniciar sesión para comentar.


Walter Roberson
Walter Roberson el 20 de Abr. de 2014

Arjun Chawla
Arjun Chawla el 11 de Dic. de 2017
How would i create this same type of function but use a slider to navigate instead of push buttons?
  1 comentario
Walter Roberson
Walter Roberson el 11 de Dic. de 2017
https://www.mathworks.com/matlabcentral/answers/352254-adjusting-slider-to-scroll-trough-each-image-in-3d-stack-in-gui

Iniciar sesión para comentar.

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by