How to skip the no of frames in a video

조회 수: 6 (최근 30일)
MJ Thangaraj
MJ Thangaraj 2016년 3월 4일
댓글: Walter Roberson 2019년 1월 23일
Suppose i want to read only one of every 10 frames of a Video
  댓글 수: 2
James Ang
James Ang 2019년 1월 23일
hi, does the answer really tell how to read every 10th frame of the video? as in frame 10,20,30,40...etc
Walter Roberson
Walter Roberson 2019년 1월 23일
You can loop passing in one frame index at a time to the read() method. Or you can fetch the estimate of the number of frames and calculate 10:10:NumbeOfFrames as the index for the read() method. Watch out for the fact that the number of frames is only an estimate.

댓글을 달려면 로그인하십시오.

답변 (1개)

B.k Sumedha
B.k Sumedha 2016년 3월 4일
Use read option to read only particular frames.Remaining files will be discarded automatically.
v = VideoReader('xylophone.mp4');
%Read only the first video frame.
video = read(v,1);
%Read only the last video frame.
video = read(v,Inf);
%Read frames 5 through 10.
video = read(v,[5 10]);
%Read from the 50th frame to the end of the video file.
video = read(v,[50 Inf]);
  댓글 수: 1
Walter Roberson
Walter Roberson 2016년 3월 4일
Using read() is no longer recommended for reading frames from VideoReader objects. The recommendation now is to use readFrame(), which can read one frame at a time. You can loop discarding frames if you want. See http://www.mathworks.com/help/matlab/import_export/read-video-files.html

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Audio and Video Data에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by