필터 지우기
필터 지우기

How to make a push button to display an image.

조회 수: 3 (최근 30일)
nurul hafizah
nurul hafizah 2015년 5월 9일
답변: Walter Roberson 2015년 5월 9일
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.

답변 (1개)

Walter Roberson
Walter Roberson 2015년 5월 9일
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');

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by