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.
0 个评论
回答(4 个)
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
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
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
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 个评论
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.
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
2017-12-11
https://www.mathworks.com/matlabcentral/answers/352254-adjusting-slider-to-scroll-trough-each-image-in-3d-stack-in-gui
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Interactive Control and Callbacks 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!