Problem with "drawnow" function and axes - GUI MATLAB
Mostrar comentarios más antiguos
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 comentarios
Sean de Wolski
el 12 de Jun. de 2013
What error? Please post the full error message.
Shadi Al Mahallawy
el 12 de Jun. de 2013
Respuestas (1)
Image Analyst
el 12 de Jun. de 2013
Try
fh = imshow(ss, 'Parent', handles.axes1); % or axes 2 depending on which you want.
Categorías
Más información sobre Interactive Control and Callbacks en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!