Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Reading in an Entire Video

1 回表示 (過去 30 日間)
Kevin Castell
Kevin Castell 2019 年 5 月 20 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I would like to read in an entire video as a matrix if possible. I know this runs into the memory usage problem. My main concern is that I would like to analyze the video frame by frame, in a faster manner than literally looping through the data. Ideally, I could plot the data from a region of interst to see if there has been a change in that region at any point during the video. I am currently using the CurrentTime function from the VideoReader class to just check in intervals. I also tried using memmapfile but I do not really understand how the function works.

回答 (1 件)

KSSV
KSSV 2019 年 5 月 21 日
vidObj = VideoReader('C:\Users\Public\Videos\Sample Videos\Wildlife.wmv');
numFrames = 0;
iwant = cell([],1) ;
while hasFrame(vidObj)
F = readFrame(vidObj);
numFrames = numFrames + 1;
imagesc(F)
drawnow
iwant{numFrames} = F ;
end
numFrames
  1 件のコメント
Kevin Castell
Kevin Castell 2019 年 5 月 21 日
I have already tried this strategy and the problem is say I have a video that is 2 hours long at 60fps, if we assume that any processing i do on the frames is performed just as fast as they are played, and the loop is as fast or slightly faster than the fps, it will take at least 2 hours to process the video. I want to process the video in under 2 minutes.

Community Treasure Hunt

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

Start Hunting!

Translated by