How to Capture frames from live streaming using camera? Each Time when the start button is clicked it should capture images after 5 seconds pause and save the images session-wise.

6 views (last 30 days)
I have tried the following code,
(1) I want to the camera to stop when the session ends and strat again when the start button is clicked.
(2) I want to save the captured frames session wise into the folder.
please help me , I am biggner to MATLAB
% --- Executes on button press in camerabutton.
function camerabutton_Callback(hObject, eventdata, handles)
Folder = 'CapImages\';
vid = handles.cam;
axes (handles.axes1)
hImage=image(zeros( 720,1280,3),'Parent',handles.axes1);
hImage = image(handles.axes1 ,zeros(720,1280,3));
preview (vid,hImage);
guidata (hObject, handles);
for iframe = 1:10;
frames = snapshot(vid);
pause(5);
imwrite(frames, fullfile(Folder, sprintf('%0d.jpg',iframe)));
end
f = msgbox({'Operation';'Completed'});
preview(vid)

Answers (0)

Community Treasure Hunt

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

Start Hunting!