Azzera filtri
Azzera filtri

How to make a push button to display an image.

3 visualizzazioni (ultimi 30 giorni)
nurul hafizah
nurul hafizah il 9 Mag 2015
Risposto: Walter Roberson il 9 Mag 2015
I want to create a GUI that have 2 push button, 2 axes to display images. the first push button (pb_load) is to load an image and display it in axes1.
if true
[filename pathname] = uigetfile ({'*.jpg';'*.bmp';'*.gif'}, 'Pick an Image');
myImage=strcat(pathname,filename);
axes(handles.axis1);
imshow(myImage);
set(handles.axis1,'visible','off');
guidata(hObject, handles);
end
the second push button is to change the image into R image and display it in axes2.
I do not know the coding that I can use for the push button 2. I also want the axes do not show x-axis and y-axis. But i do not know how.

Risposte (1)

Walter Roberson
Walter Roberson il 9 Mag 2015
imagehandle = findobj(axes(handles.axis1),'type','image');
imagedata = get(imagehandle, 'CData');
newimagedata = 255 - imagedata; %some transformation since I do not know what "R image" means
newimagehandle = imshow(newimagedata, 'Parent', handles.axes2);
set(handles.axes2, 'Visible', 'off');

Categorie

Scopri di più su Migrate GUIDE Apps in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by