实际运行程序为:
// example_p21.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include "highgui.h"//包含图形用户界面和图像/视频的读/写
int _tmain(int argc, _TCHAR* argv[])
{
CvCapture* capture = cvCreateFileCapture( "1.AVI" );
cvNamedWindow( "Example2", CV_WINDOW_AUTOSIZE);
IplImage* frame;
while(1)
{
frame = cvQueryFrame( capture );
if(!frame)
break;
cvShowImage("Example2", frame );
char c = cvWaitKey(33);
if( c == 27 )//ESC的ASCII码是27
break;
}
cvReleaseCapture( &capture );
cvDestroyWindow( "Example2" );
return 0;
}
效果图如下: