Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

I get error when I closed the window before selected the stop button for live video

1 vue (au cours des 30 derniers jours)
Han
Han le 22 Fév 2018
Clôturé : MATLAB Answer Bot le 20 Août 2021
I have the following code for live video:
function track_OpeningFcn(hObject, eventdata, handles, varargin)
movegui(hObject,'center')
imaqreset
vid = videoinput('winvideo',1);
handles.video = vid;
set(handles.video,'TimerPeriod', 0.05, ...
'TimerFcn',['if(~isempty(gco)),'...
'handles=guidata(gcf);'...
'image(getsnapshot(handles.video));'...
'set(handles.axes2,''ytick'',[],''xtick'',[]),'...
'else '...
'delete(imaqfind);'... % Clean up - delete any image acquisition objects
'end']);
triggerconfig(handles.video,'manual');
handles.video.FramesPerTrigger = Inf;
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
uiwait
function StartVideo_Callback(hObject, eventdata, handles)
vid = handles.video;
start (vid);
guidata(hObject, handles)
function StopVideo_Callback(hObject, eventdata, handles)
vid = handles.video;
stop (vid);
guidata(hObject, handles)
function track_CloseRequestFcn(hObject, eventdata, handles)
uiresume
delete(hObject)
delete (handles.video)
imaqreset
I get this error when I closed the window before selected the stop button:
Error using imaqdevice/getsnapshot (line 65)
Image acquisition object OBJ has been deleted. OBJ is now an invalid object.

Réponses (0)

Cette question est clôturée.

Community Treasure Hunt

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

Start Hunting!

Translated by