(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