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 个评论
Sean de Wolski
2013-6-12
What error? Please post the full error message.
Shadi Al Mahallawy
2013-6-12
回答(1 个)
Image Analyst
2013-6-12
Try
fh = imshow(ss, 'Parent', handles.axes1); % or axes 2 depending on which you want.
类别
在 帮助中心 和 File Exchange 中查找有关 Interactive Control and Callbacks 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!