1 #include "stdafx.h" 2 #include "highgui.h" 3 int main() 4 { 5 cvNamedWindow("example",CV_WINDOW_AUTOSIZE); 6 CvCapture* capture=cvCreateFileCapture("test.avi");//load avi file 7 IplImage* frame; 8 while(1){ 9 frame=cvQueryFrame(capture);//read the frame 10 if(!frame)break; 11 cvShowImage("example2",frame); 12 char c=cvWaitKey(33);//if you press a key and store it into c 13 if(c==27)break;//27 present for ESC key 14 } 15 cvReleaseCapture(&capture); 16 cvDestroyWindow("example"); 17 19 }
显示avi,rmvb感觉问题不大~