FrameRate and FramePerTrigger during acquisition and writing into a video-file
5 次查看(过去 30 天)
显示 更早的评论
Hi,
I don't understand how create a video-file setting the right matching between FrameRate and FramePerTrigger during image acquisition.
I write:
vid = videoinput('winvideo', 1, 'YUY2_640x480');
vid.ReturnedColorspace = 'rgb';
writerObj= VideoWriter('object.avi');
writerObj.FrameRate = 30;
open(writerObj);
set(vid,'TriggerRepeat',Inf);
vid.FramesPerTrigger = 30; %as frame rate
start(vid)
while(vid.FramesAcquired<=500) % Stop after 501 frames
data = getdata(vid,1);
imshow(data)
writeVideo(writerObj,data);
end
stop(vid)
close(writerObj)
close
but it retuns a video file a little bit faster than real motion
回答(1 个)
Walter Roberson
2012-7-30
As a general statement:
Usually, provided you have enough buffer memory, then more frames you acquire per trigger, the more efficient the acquisition is -- but then of course you have more latency.
Likewise, if you acquire fewer frames per trigger, you have more acquisition overhead per frame, which can potentially lead to dropping frames.
It is worth keeping in mind that although MATLAB's builtin routines are compiled to machine code, MATLAB itself is an interpreted language, so the higher percentage of the time you are executing MATLAB statements (managing the acquisition process, triggering the acquisition, processing on smaller buffers when aggregating frames into larger buffers might be more efficient), the more likely you are to run out of time and need to drop frames; the acquisition drivers are compiled and can handle interrupts better and so on.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Acquisition Support Packages for Hardware Adaptors (Generic Video Interface) 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!