FrameRate and FramePerTrigger during acquisition and writing into a video-file

조회 수: 5 (최근 30일)
cyberdyne
cyberdyne 2012년 7월 30일
댓글: Ria Paul 2017년 6월 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
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.

Community Treasure Hunt

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

Start Hunting!

Translated by