how to display multiple images and view them one after another in one axes

6 ビュー (過去 30 日間)
nida
nida 2014 年 4 月 21 日
回答済み: Dr. Murtaza Ali Khan 2018 年 6 月 19 日
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

回答 (1 件)

Dr. Murtaza Ali Khan
Dr. Murtaza Ali Khan 2018 年 6 月 19 日
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.

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by