MATLAB background imshow image.

조회 수: 5 (최근 30일)
Szabo Hunor
Szabo Hunor 2011년 5월 15일
댓글: Malini Bakthavatchalam 2020년 6월 2일
I use an axis for preview the background image in background, i use an another to preview the image in a little box, but when i click "show image" the image rewrite my background image.
Sorry for my bad english, Regards, Hunor
Here is a code: function pushbutton10_Callback(hObject, eventdata, handles) axes(handles.axes1); global kep; global a; imshow(kep);
function axes3_CreateFcn(hObject, eventdata, handles)
backgroundImage = importdata('hatter.jpg');
image(backgroundImage);
axis off;

채택된 답변

Arturo Moncada-Torres
Arturo Moncada-Torres 2011년 5월 16일
I have tested the following code and it works. Add it to your own.
% In the pushbutton3 callback
handles.output = hObject;
backgroundImage = importdata('background.jpg');
imshow(backgroundImage, 'Parent',handles.axesBackground);
axis off;
axis image;
guidata(hObject, handles);
% In the pushbutton5 callback
handles.output = hObject;
littleBoxImage = importdata('image.jpg');
imshow(littleBoxImage, 'Parent',handles.axesLittleBox);
axis off;
axis image;
guidata(hObject, handles);
Defining the "parent" property allows you to choose in which axes you will display the image. I had used the axes(handles.myAxes) for plotting, not for image display, so I suppose that was the problem.
This should (finally!) work. Give it a try ;-) .
  댓글 수: 3
Arturo Moncada-Torres
Arturo Moncada-Torres 2011년 5월 17일
No problem ;-) .
Keep coding!
Malini Bakthavatchalam
Malini Bakthavatchalam 2020년 6월 2일
Hey Auturo, it shows me error ,
Undefined function or variable 'hObject'.
Error in tehre2 (line 83)
handles.output = hObject;

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Exploration에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by