Problem with "drawnow" function and axes - GUI MATLAB
Ältere Kommentare anzeigen
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 Kommentare
Sean de Wolski
am 12 Jun. 2013
What error? Please post the full error message.
Shadi Al Mahallawy
am 12 Jun. 2013
Antworten (1)
Image Analyst
am 12 Jun. 2013
Try
fh = imshow(ss, 'Parent', handles.axes1); % or axes 2 depending on which you want.
Kategorien
Mehr zu Interactive Control and Callbacks finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!