Info

この質問は閉じられています。 編集または回答するには再度開いてください。

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

1 回表示 (過去 30 日間)
Han
Han 2018 年 2 月 22 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
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.

回答 (0 件)

この質問は閉じられています。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by