Key Frames Extraction in a Video

조회 수: 6 (최근 30일)
G-ONE
G-ONE 2012년 11월 13일
댓글: Shivam Thakur 2018년 10월 7일
Hello Everyone
I am working on a assignment "key frames extraction in a video sequence" Method that i am using as follows
->extracts frames one by one
->histogram difference between two consecutive frames using imhist() and
imabsdiff()
->calculate mean and standard deviation of difference and threshold
->continue till end of video
->again extracts frames one by one
->histogram difference between two consecutive frames using imhist() and
imabsdiff()
->compare this difference with threshold and if it is greater than threshold
select it as a key frame
->continue till end of video
is this method correct??
if anyone have good solution plz help me with the code
thanks in advance
my simple code
vid = 'Wildlife 00_00_20-00_00_30.avi';
readerobj = mmreader(vid);
for k=1: readerobj.NumberOfFrames
I=read(readerobj,k);
if(k~= readerobj.NumberOfFrames)
J=read(readerobj,k+1);
sss=absdif(I,J);
X(k)=sss;
end
end
mean=mean2(X)
std=std2(X)
threshold=std+mean*4
for k=1: readerobj.NumberOfFrames
I = read(readerobj,k);
if(k~=readerobj.NumberOfFrames)
J= read(readerobj,k+1);
sss=absdif(I,J);
if(sss>mean)
imwrite(J,strcat('D:\',Names{k+1}));
end
end
% absdif function
function [ res ] = absdif( I,J )
k=rgb2gray(I);
l=rgb2gray(J);
m=imhist(k);
n=imhist(l);
dif=imabsdiff(m,n);
res=sum(dif);
end
  댓글 수: 21
Walter Roberson
Walter Roberson 2016년 10월 21일
Use imabsdiff instead of absdif
Shivam Thakur
Shivam Thakur 2018년 10월 7일
Sir I work in one video project.When I try this code I get the error is " subscripted Assignment Dimension mismatch"....in line X(k)=sss.please solve the error sir.

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

답변 (1개)

Rajendra Oli
Rajendra Oli 2018년 3월 30일
Is cnn algorithm used in this code?
  댓글 수: 1
Walter Roberson
Walter Roberson 2018년 3월 30일
No, cnn is not used in the above code.
It might be possible to develop a key frame extraction algorithm that uses Convolutional Neural Networks as part of the algorithm, but this is not such an algorithm.
http://ieeexplore.ieee.org/document/8311477/ CNN based key frame extraction for face in video recognition
https://link.springer.com/chapter/10.1007%2F978-981-10-7305-2_51 Deep Key Frame Extraction for Sport Training

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

Community Treasure Hunt

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

Start Hunting!

Translated by