% --- Executes on button press in pushbutton4.
%连续采集摄像机1
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton4 (see GCBO)
global i;
i=0;
period=str2double(get(handles.timeperiod,'string'));
t = timer('TimerFcn', [email={@timerCallback,handles]{@timerCallback,handles[/email]}, 'ExecutionMode', 'fixedRate', 'Period', period);
handles.t=t;
guidata(hObject,handles);
start(t);
% axes(handles.axes3);
% figure(handles.axes3);
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
function timerCallback(hObject, eventdata, handles)
global vid1
global i;%left一侧图像命名标号
i=i+1;
if (vid1==-1)
msgbox('Prview First ','ilovematlab,'icon','error');
return;
end
frame = getsnapshot(vid1);
axes(handles.axes3);
imshow(frame);
str=strcat('left',num2str(i,'%03.f'),'.jpg'); %图像名称由left001~left999
imwrite(frame,str,'jpg');
% --- Executes on button press in pushbutton6.
%停止采集摄像机1
function pushbutton6_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton6 (see GCBO)
try
stop(handles.t);
catch
end
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
有高手吗?我急死了。。。。。