Can we store the frames of a video in a variable or by any other method?

3 次查看(过去 30 天)
I basically need to create a frame memory(i.e. simply a place to store frames in my video) for my video. How can I do that? And secondly, after creation of such memory, how can I perform motion compensation based prediction(of the next frame) from the memory?

回答(1 个)

Walter Roberson
Walter Roberson 2017-7-19
Approximately,
idx = 0;
while hasFrame(videoobject)
idx = idx + 1;
stored_frames{idx} = readFrame(videoobject);
end
Note: If the video is stored in a file, then I would recommend reading the file through once just to count the frames so you can pre-allocate the stored_frames variable.
Also, it can be more efficient to instead use a multidimensional numeric array instead of using cell arrays.

Community Treasure Hunt

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

Start Hunting!

Translated by