how can i extract all frame and logged to disk from an given input video(webcam)

4 visualizaciones (últimos 30 días)
%-Start
vidFormat = 'YUY2_320x240';
vid=videoinput('winvideo',1,vidFormat);
triggerconfig(vid,'manual');
set(vid,'FramesPerTrigger',1);
set(vid,'TriggerRepeat', Inf);
set(vid,'ReturnedColorspace','rgb');
start(vid);
for k=1:5
trigger(vid);
im= getdata(vid,1);
imshow(im);
end
stop(vid),delete(vid),clear vid;

Respuestas (1)

Walter Roberson
Walter Roberson el 11 de Mayo de 2012
You probably will not be able to record all frames to disk. The frame rate for 320 x 240 is usually fairly high (often 60 frames per second), which is probably faster than you can record, and is certainly faster than you can write to disk.
If you were to restrict the time sampled over to a small number of seconds, then you could potentially record the frames in memory and then write the frames to disk after the sampling time is over.
There are a number of ways to write individual frames to disk. The method you use will depend on how you want to process the frames afterwards.
  1 comentario
Mohd Aquib
Mohd Aquib el 23 de Mayo de 2013
Editada: Mohd Aquib el 23 de Mayo de 2013
hi walter m facing the same pblm...i need to extact all the frames(memory) and store it to a particular folder...so what i shd do..code is as follows
vid = videoinput('winvideo',1);
preview(vid);
set(vid,'TriggerRepeat',Inf);
set(vid,'ReturnedColorSpace','grayscale');
vid.FrameGrabInterval = 1;
% Set value of a video source object property. vid_src = getselectedsource(vid);
set(vid_src,'Tag','motion detection setup');
disp(sprintf(' FRAMING START from VIDEO'));
start(vid);
while(vid.FramesAcquired<=50) % Stop after 100 frames
data = getdata(vid,2);
diff_im = imabsdiff(data(:,:,:,1),data(:,:,:,2));
imshow(diff_im);
end
}
for making a folder and storing frames(from memory) to this folder
m tring this code between the above code but these errors r found
1) permission is denied for MKDIR 2) undefined function fullfile..
outputFolder = fullfile(cd, 'Test');
if ~exist(outputFolder, 'dir')
mkdir(outputFolder);
end
outputBaseFileName = disp('Image %3.3d.jpg',vid);
disp(outputBaseFileName);
outputFullFileName = fullfile(outputFolder, outputBaseFileName);
m in trouble plz help so dat i cd store these frame to a folder

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by