简体   繁体   中英

OpenCV finding picture (frame) in video

I am trying to create small application in C++ that will return probability value (real number from 0 to 1) for recognizing two pictures in video. My idea is to find commercials in certain video material. I was thinking to cut first frame from commercial as well as the last one. In that way I could create app, using OpenCV, that will load a video (TV content) and then it will search for the first frame catted from commercials. If it finds it (with probability more than SOME_PARAMETER) than app can conclude that that commercials starts there. Then I would like to search for the last frame and if it's found (again with probability more than SOME_PARAMETER) than the app can conclude that wanted commercial really exists in given video. This is just an idea. I am expert in C++ but totally newbie with OpenCV. If someone can point me out, or give an example it would be much appreciated. Of course I am open to any suggestions regarding idea. Thanks,

M.

What you are looking for is known as template matching in OpenCV.

To get acquainted with OpenCV you should start reading some tutorials , besides the books there are some good ones on the web. As a C++ guy, you will probably use the C++ interface of OpenCV which uses cv::Mat as the main data structure to represent images. If you see the IplImage data type being used, know it's from the C interface.

After the preliminaries, you will eventually need to learn how to read frames from a video:

and then how to process those frames, individually:

Finally, you will investigate how template matching works:

There are other ways to track objects besides template matching, check these references:

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