how to display multiple images and view them one after another in one axes
6 views (last 30 days)
Show older comments
i have a sample gui in which i want to show multiple images in axes. and i want to view them like a slide show with two pushbuttons next and back heres my code for two buttons.this code makes an index of images.
function Backbutton_Callback(hObject, eventdata, handles)
% hObject handle to Backbutton (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% handles.output = hObject;
handles.index = handles.index - 1;
guidata(hObject, handles);
Cek(hObject, eventdata, handles);
axes(handles.Axes2);
imshow({handles.index},[]);
guidata(hObject, handles);
function Nextbutton_Callback(hObject, eventdata, handles)
% hObject handle to Nextbutton (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% handles.output = hObject;
handles.index = handles.index + 1;
guidata(hObject, handles);
Cek(hObject, eventdata, handles);
%handles.X(:,:,handles.index)=rgb2gray(imread('Illusion.jpg'));
axes(handles.Axes2);
imshow((handles.index),[]);
guidata(hObject, handles);
function cek(hObject, eventdata, handles)
% axes(handles.Axes2);
% handles.output = hObject;
n = 10;%length(handles.files);
if handles.index > 1, set(handles.Backbutton,'enable','on');
else set(handles.Backbutton,'enable','off'); end
if handles.index < n, set(handles.Nextbutton,'enable','on');
else set(handles.Nextbutton,'enable','off'); end
guidata(hObject, handles);
and this doesnt work when i press nexbutton, image on axes disappears.im really stuck. thanks
0 Comments
Answers (1)
Dr. Murtaza Ali Khan
on 19 Jun 2018
The attached code may help someone with the same need. It navigates though sequence of loaded images via Next and Previous push buttons. The code is build using "GUIDE", gui interface builder for MATLAB.
0 Comments
See Also
Categories
Find more on Image Processing Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!