开发者

open source shot detection implementation?

I am trying to implement a video retrieval system and I need to first extract key frames from a video, ideally I want to have a library for automatically detec开发者_运维技巧ting those key frames, one key frame from each shot. Bonus if I can configure which key frame to extract(first, middle, or last of the continuous frames in a shot). Is there an open source implementation for this?


What you're after is called shot segmentation. While it's a pretty active research area, I think you're unlikely to find any complete libraries that solve the problem for you out-of-the-box. Your best option may be reading up on the topic, selecting an approach that best fits your requirements and coding it up yourself.

One approach is to calculate the chi-squared distance between the color histograms of adjacent frames. When this distance rises above a user-specified threshold, you are at a shot boundary. The approach is explained in this paper:

A. Nagasaka and Y. Tanaka, "Automatic video indexing and full-video search for object appearances", Journal of Information Processing archive, Volume 15, Issue 2 (1992), Page 316

I've played around with it, with some success. Notable failures are sudden light changes within a single shot (caused by camera flash, etc) and blending shot changes.

Once you know the shot boundaries, picking a keyframe from each shot will be trivial, as other people have pointed out.


The ffmpeg lib (included in openCV) can seek to a keyframe with av_seek_frame()

see FFMPEG reading keyframes


If you have as an input an uncompressed video, you can download the ffmpeg from [www.ffmpeg.org] and use this executable to decompress your video stream into its frames.

Subsequently, in order to detect your shot boundaries you have to extract some features from the video keyframes. An efficient technique for shot boundary detection is proposed in MediaMixer Deliverable, D1.1.2. In addition, in MediaMixer Webinars you can find the lecture “Fragmenting your Media Assets meaningfully – media analysis for fragment detection and extraction” where this shot-boundary detection implementation is presented, while you can also visit the MediaMixer demonstrator [http://www.mediamixer.eu/automatic-fragmentation-and-annotation-for-improved-access-to-lecture-videos/] where the results of video shot segmentation and concept detection are visualized.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜