how to develop a FIFO for realtime image acquisition
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I want to create a FIFO for real time face tracking with my webcam. To prevent a memory overflow i want to create something like a FIFO. I thought grabbing the images with „peekdata“ and releasing them with „fluemshdata“ would do the job. However cheking the memory shows that the memory used by matlab is still increasing. So what ist he best way to do that? Thank you very much.
My code so far:
%%real time video
% be shure you installed the
% "Image Acquisition Toolbox Support Package for OS Generic Video Interface" - Add on
%%Initialise Video
% list of all installed adaptors
imaqhwinfo
% my fist webcam:
info = imaqhwinfo('winvideo',2);
try
% Create a Video Input Object
vid = videoinput('winvideo',2,info.DefaultFormat);
catch
stop(vid);
clear vid;
vid = videoinput('winvideo',2,info.DefaultFormat);
end
% continuous image acquisition:
vid.TriggerRepeat = Inf;
vid.FrameGrabInterval = 1;
vid.FramesPerTrigger=1;
%videoPlayer = vision.VideoPlayer;
%videoPlayer.Position=vid.ROIPosition+50;
start(vid);
% Track the face over successive video frames until the video is finished.
while 1
% Extract the next video frame
frame=peekdata(vid,1);
%frame=getsnapshot(vid);
% to prevent memoryissues - remove the oldest trigger data -
% we have now something like a FIFO (ring bufffer). We keep the newest
% 100 Frames
flushdata(vid,'trigger');
memo=memory
end
%%clear up
flushdata(vid);
stop(vid);
delete(vid);
imaqreset; % Disconnect and delete all image acquisition objects
close(gcf)
0 Kommentare
Antworten (1)
Siehe auch
Kategorien
Mehr zu Image Acquisition Support Packages for Hardware Adaptors (Generic Video Interface) finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!