function connect_Callback(hObject, eventdata, handles)
handles.timer = timer('Name','MyTimer', ...
'Period',1, ...
'StartDelay',1, ...
'TasksToExecute',inf, ...
'ExecutionMode','fixedSpacing', ...
'TimerFcn',{@timerCallback,handles.figure1});
handles.vid = ipcam('http://100.75.51.93:8081/', 'admin', '12345');
guidata(hObject,handles);
start(handles.timer);
function disconnect_Callback(hObject, eventdata, handles)
if isfield(handles, 'vid') && isfield(handles, 'timer')
stop(handles.timer);
stop(handles.vid);
flushdata(handles.vid);
cla(handles.axes1);
delete(handles.vid);
handles.vid = [];
guidata(hObject, handles);
end
function [] = timerCallback(~,~,guiHandle)
if ~isempty(guiHandle)
[Imag_filled1, Imag_in1] = IPProcessamentoRed(handles.vid);
axes(handles.axes1);
imshow(Imag_in1);
axes(handles.axes2);
imshow(Imag_filled1);
end
Best Answer