0

I am currently writing a code in order to detect small objects that are moving using OpenCV and C++. I have motion detection, logging of detects, and bounding boxes working well. Now I am stuck on a way to take the video, and after I get a detection, grab 5 seconds before and 5 seconds after the detection period and save it out to a different .avi file. Does anyone have ideas on a way to do this? Even a point in the general direction would be helpful as I can't seem to find anything on taking out clips from a .avi file and saving them to different files.

  • Push your `cv::Mat` on a double ended queue and make sure you do not remove than 5 * fps frames in case you detect motion and record the subsequent 5 * fps frames. – hetepeperfan Jul 17 '13 at 19:47
  • constantly store last `5* ` frames in a vector, removing the oldest frame when you put in a new current frame (thus, you are essentially implementing a circular buffer). Then when you detect an object write video to a file using frames stored in the buffer plus another 5 seconds of frames starting from the time of detection. – Alexey Jul 17 '13 at 19:58

0 Answers0