clear all; %% clear all privious variables
clc;
close all
cam = webcam('Integrated Webcam')
vid = videoinput('winvideo',1);
set(vid, 'FramesPerTrigger', Inf);
set(vid, 'ReturnedColorspace', 'rgb');
% vid.FrameRate =30;
vid.FrameGrabInterval = 1; % distance between captured frames
%start(vid)
aviObject = VideoWriter('myVideo.avi'); % Create a new AVI file
open(aviObject)
for iFrame = 1:150 % Capture 150 frames
% ...
% You would capture a single image I from your webcam here
% ...
I=getsnapshot(vid);
%imshow(I);
F = im2frame(I); % Convert I to a movie frame
writeVideo(aviObject,F); % Add the frame to the AVI file
pause(0.1)
end
close(aviObject); % Close the AVI file
stop(vid);
But I keep getting this error: Error using videoinput (line 532)
winvideo: Image acquisition device is not accessible.
Insufficient system resources exist to complete the requested service.
Make sure no other objects or applications are accessing the same device.
Error in AcquireVideo (line 11)
vid = videoinput('winvideo',1);