OpenCV extracts each frame of a video and continuously combines images into a video. opencv extracts

Source: Internet
Author: User

(Conversion) OpenCV extracts each frame of the video and then combines consecutive images into a video. opencv extracts

Reference blog: http://blog.sina.com.cn/s/blog_60b330b801018s0u.html

Running Environment: Win7 OpenCV1.0 VC6.0. The following video generation Code uses the XVID encoder. If no download is required on the computer, otherwise the size of the generated video file is 0. Or you can set cvCreateVideoWriter ("out. avi ", CV_FOURCC ('x', 'V', 'I', 'D'), fps, cvSize (frameW, frameH), isColor) 'x ', 'V', 'I', and 'D' can be changed to an existing encoder on the computer.

 

Note: multiple images are merged into videos, so the last generated video has no sound.

1 // This program converts videos and images. 2 // The Image_to_video () function combines a group of images into an AVI video file. 3 // The Video_to_image () function reads an AVI video file and stores each frame as a jpg file. 4 // 5 //////////////////////////////////// /// // 6 # include <stdlib. h> 7 # include <stdio. h> 8 # include <math. h> 9 # include <cv. h> 10 # include 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.