How to extract photos from video at equal intervals?

조회 수: 10 (최근 30일)
Wesley
Wesley 2020년 11월 17일
댓글: Wesley 2020년 11월 18일
I shot the video while doing the experiment.When processing video, I need to extract pictures of 10 seconds, 20 seconds, 30 seconds, 40 seconds, and 50 seconds for comparison.I am a MATLAB beginner, please help me to solve this problem with MATLAB program.

답변 (1개)

Hrishikesh Borate
Hrishikesh Borate 2020년 11월 18일
Hi,
I understand that you are trying to extract frames from a video at 10 seconds, 20 seconds, 30 seconds, 40 seconds, 50 seconds. Following is the code to perform the operation : -
v = VideoReader('exampleVideo.mp4');
time = [10, 20, 30, 40, 50];
for i=1:numel(time)
if time(i)<v.Duration
v.CurrentTime = time(i);
frame = readFrame(v);
figure; imshow(frame); %Perform processing on the frame here
end
end
For more information, refer to VideoReader.
  댓글 수: 1
Wesley
Wesley 2020년 11월 18일
However, I still have a question about how to save these pictures.Thank you so much for helping me answer this question

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

Community Treasure Hunt

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

Start Hunting!

Translated by