Filter löschen
Filter löschen

How to make a push button to display an image.

3 Ansichten (letzte 30 Tage)
nurul hafizah
nurul hafizah am 9 Mai 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.

Antworten (1)

Walter Roberson
Walter Roberson am 9 Mai 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');

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by