Info
此问题已关闭。 请重新打开它进行编辑或回答。
I get error when I closed the window before selected the stop button for live video
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(0 个)
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!