How do I perform time lapse image acquisition and save individual images?
5 ビュー (過去 30 日間)
古いコメントを表示
MathWorks Support Team
2017 年 9 月 19 日
編集済み: MathWorks Support Team
2021 年 2 月 25 日
I want to perform time-lapse image acquisition, saving each acquired frame as a separate image.
採用された回答
MathWorks Support Team
2021 年 3 月 5 日
編集済み: MathWorks Support Team
2021 年 2 月 25 日
Follow a modified form of the approach example is this example:
https://www.mathworks.com/help/imaq/creating-time-lapse-video-using-a-noncontiguous-acquisition.html
Instead of logging to disk, log data to memory. Use the FramesAcquiredFcn callback to save individual frames as images:
vid = videoinput('winvideo');
%% Do actual time-lapse acquisition
framerate = 17.5296; % Previously calculated according to example
capturetime = 30;
vid.FrameGrabInterval = 10;
vid.FramesPerTrigger = floor(capturetime * framerate / vid.FrameGrabInterval);
vid.FramesAcquiredFcnCount = 1; % Execute callback for each frame
vid.FramesAcquiredFcn = @saveFrame;
start(vid);
wait(vid, Inf);
function saveFrame(vid, event)
image = getdata(vid, 1);
imwrite(image, [num2str(vid.FramesAcquired) '.jpg']);
end
0 件のコメント
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!