Problem with "drawnow" function and axes - GUI MATLAB

I developed an interface (GUI), containing 2 axes. Each axes is assiociated with a "pushbutton" called "StartCam". What basicilly happens is that when pushbutton is called, the following call-back function is called:
function StartCam1_Callback(hObject, eventdata, handles)
url = 'http://192.168.1.2:80/jpg/image.jpg?timestamp=';
ss = imread(url);
fh = image(ss);
while(1)
ss = imread(url);
set(fh,'CData',ss);
axes(handles.axes1);
drawnow;
end
% --- Executes on button press in StartCam2.
function StartCam2_Callback(hObject, eventdata, handles)
url = 'http://192.168.1.3:80/jpg/image.jpg?timestamp=';
ss = imread(url);
fh = image(ss);
while(1)
ss = imread(url);
set(fh,'CData',ss);
axes(handles.axes2);
drawnow;
end
Two IP cameras with Two url's as shown above in the code, the problem is when the I run the GUI, I cant get to stream cam1 on axes1 and cam2 on axes2.
I thought using axes(handles.axes1); before drawnow is supposed to draw the stream on axes2 but it gives back an error.
So,How can I draw each stream on its individual axes ?? Thanks % code end

댓글 수: 2

What error? Please post the full error message.
Actually, there isnt an error, both pushbuttons work fine, but all on the same axes, instead of "StartCam1"--> "Axes1" and "StartCam2" -- >"Axes2", they both draw on Axes1. Sorry for the mix up

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

답변 (1개)

Image Analyst
Image Analyst 2013년 6월 12일

0 개 추천

Try
fh = imshow(ss, 'Parent', handles.axes1); % or axes 2 depending on which you want.

카테고리

도움말 센터File Exchange에서 Graphics Object Properties에 대해 자세히 알아보기

질문:

2013년 6월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by