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

3 views (last 30 days)
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?

Answers (1)

Walter Roberson
Walter Roberson on 19 Jul 2017
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!