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

9 次查看(过去 30 天)
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.

回答(4 个)

Sonalika
Sonalika 2014-4-27
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 个评论
Sonalika
Sonalika 2014-4-27
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 2014-4-28
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.

请先登录,再进行评论。


Image Analyst
Image Analyst 2014-4-18
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 个评论
asif
asif 2014-4-20
is there any other alternative to view multiple images one by one.
Image Analyst
Image Analyst 2014-4-20
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.

请先登录,再进行评论。


Walter Roberson
Walter Roberson 2014-4-20

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

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Interactive Control and Callbacks 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by