필터 지우기
필터 지우기

imshow in GUI

조회 수: 16 (최근 30일)
Edward P
Edward P 2011년 11월 3일
댓글: Christos Stefos 2014년 2월 4일
Hi,
I have two axes on my gui fig.
when i push a button i want to load two images for each axes. so i tried this.
% --- Executes on button press in Insert.
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton4 (see GCBO)
% Invoca duas fotos
% % FOTO 1
[filename,pathname] = uigetfile({'*.jpg';'*.tif';'*.*'}, 'Fotografia Direita');
fich1 = fullfile(pathname,filename);
%
% % FOTO 2
[filename,pathname] = uigetfile({'*.jpg';'*.tif';'*.*'}, 'Fotografia Esquerda');
fich2 = fullfile(pathname,filename);
if(exist(fich1) && exist(fich2))
D=imread(fich1);
E=imread(fich2);
imshow(D,'Parent',axes1);
imshow(E,'Parent',axes2);
end
guidata(hObject, handles);
How can i use this 'Parent' parameter, to make corresponding an image to an specific axes?

채택된 답변

Image Analyst
Image Analyst 2011년 11월 3일
Perhaps you should try
imshow(D,'Parent', handles.axes1);
imshow(E,'Parent', handles.axes2);
Anytime you need to refer to any of the controls in your gui, you need to put "handles." before the name of the "tag."
  댓글 수: 3
Julio Vilela
Julio Vilela 2012년 7월 26일
Superb! I've been googling this for so long, and here is the answer, thanks!!!
Christos Stefos
Christos Stefos 2014년 2월 4일
superb answer..very helpful!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Jan
Jan 2011년 11월 3일
imshow(D, 'Parent', axes1) looks fine already, but as far as I can see in your code, axes1 is not defined. Is it a field of the handles struct?
exist(fich1) is dangerous, because it checks all variables, Java classes, folders and files. Be sure to specify exist(fich1, 'file'). Even then it can be a directory also. To be really sure use:
if exist(fich1, 'file') && ~exist(fich1, 'dir')
I think, exist is not comfortable currently.
  댓글 수: 2
Edward P
Edward P 2011년 11월 3일
Thanks Jan,
I have have design the two axes on my gui fig, im using just the tag.
how can i define axes1 and axes2?
Jan
Jan 2011년 11월 3일
The answer of Image Analyst shows, what I meant by "Is it [axes1] a field of the handles struct?".

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Display Image에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by