// vfc.cpp : 定义控制台应用程序的入口点。
#include "stdafx.h"
#include <opencv2/highgui/highgui.hpp>  
#include <iostream>  
#include <stdio.h>  
#include <cv.h>  
int main(int argc, char *argv[])  
{  
    CvCapture* capture = cvCaptureFromAVI("111.avi");  
    int i = 0;  
    IplImage* img = 0;  
    char image_name[25];  
    cvNamedWindow( "vivi");  
    //读取和显示  
    while(1)  
    {  
        img = cvQueryFrame(capture); //获取一帧图片  
        if(img == NULL)  
            break;  
  
        cvShowImage( "vivi", img ); //将其显示  
        char key = cvWaitKey(20);  
        sprintf(image_name, "%s%d%s", "..\\tutu\\image", ++i, ".jpg");//保存的图片名  
        cvSaveImage( image_name, img);   //保存一帧图片  
    }  
  
    cvReleaseCapture(&capture);  
    cvDestroyWindow("vivi");  
      
    return 0;  
} 
在目录之下建立一个tutu文件夹就可以存储读入视频的每一帧


原文:http://www.cnblogs.com/xzabg/p/5701479.html