frames deletion from video

6 ビュー (過去 30 日間)
Salim Dada
Salim Dada 2018 年 12 月 16 日
コメント済み: Mark Sherstan 2018 年 12 月 16 日
hello, I have 10 frames and I want to delete the similar frames. how can I achieve it with (for loop) on multiple arrays
  2 件のコメント
Guillaume
Guillaume 2018 年 12 月 16 日
What is a similar frame, mathematically?
Salim Dada
Salim Dada 2018 年 12 月 16 日
like this
I=[0,0,0,0,0;0,0,90,0,0;0,0,90,0,0;90,90,90,0,0;0,0,0,0,0]
k=[0,0,0,0,0;0,0,90,0,0;0,0,90,0,0;90,90,90,0,0;0,0,0,0,0]

サインインしてコメントする。

回答 (1 件)

Mark Sherstan
Mark Sherstan 2018 年 12 月 16 日
As a video is just a bunch of pictures and pictures are just matrices you can subtract the two frames (or matrices) to find the differences. How you want to analyze the data or define change (e.g. - is it 5% change or less or more) I will leave up to you. This should put you in the right direction tho:
v = VideoReader('test.mp4');
framePrev = readFrame(v);
% Loop through video frame by frame
while hasFrame(v)
frameCurrent = readFrame(v);
frameCompare = frameCurrent-framePrev;
imshow(frameCompare)
framePrev = frameCurrent;
end
  4 件のコメント
Salim Dada
Salim Dada 2018 年 12 月 16 日
I want to delete the redundant frames to compress the video
Mark Sherstan
Mark Sherstan 2018 年 12 月 16 日
vIn = VideoReader('videoIn.mp4');
vOut = VideoWriter('videoOut.mp4');
open(vOut)
framePrev = readFrame(vIn);
while hasFrame(vIn)
frameCurrent = readFrame(vIn);
if (frameCurrent ~= framePrev)
writeVideo(vOut,frameCurrent)
end
framePrev = frameCurrent;
end
close(vOut)

サインインしてコメントする。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by