简体   繁体   中英

Detecting a black/blank frame in video using OpenCV

I'm using OpenCV 2.4.2 VideoCapture class to grab frames from multiple videos and my aim is to compare the frames between videos to retrieve similar videos (visually similar).

I'm facing two issues.

  1. The videos contain blank/black frames. I can loop over each individual frame (while capturing the video) and check the pixels etc. to detect these frames. Is there a faster and more efficient way to somehow do this? I have more than 1k videos and each video has around 5k-20k frames [I'm capturing 1 frame per second]. I'm coding in C++.

  2. Comparing two huge matrices to check how "similar" they are. I eventually compute a huge matrix for each video where the rows correspond to the number of the frames, and the cols correspond to the dimensionality of the descriptor being computed on each frame. If I need to compare two videos for similarity, the simplest thing I found was to compute Euclidean matrix. But again, horribly inefficient if I scale up to 1000s of videos.

Any advice and suggestion will be appreciated.

Thanks,

Concerning the first problem, I think cv::countNonZero is the most suitable method, it works very fast as well. cv::countNonZero returns the number of non-zero elements in input single-channel array.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM