PlayVideo.c
上传用户:whhzxy
上传日期:2022-01-20
资源大小:7k
文件大小:1k
- #include <stdio.h>
- #include "highgui.h"
- #include "cv.h"
- #include "cxcore.h"
- int main(int argc,char** argv){
- //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- //需要先在此声明,否则无法使用;
- CvCapture* capture = NULL;
- IplImage* frame = NULL;
- char c;
- cvNamedWindow("saga", CV_WINDOW_AUTOSIZE);
- //cvCaptureFromFile,打开AVI文件,需要在控制台输入文件路径;
- //cvCreateFileCapture,作用好像也是一样的;
- //capture = cvCaptureFromFile(argv[1]);
- //avi, mpg, wmv, MOV 都行,中文名也可以,没有声音。
- capture = cvCreateFileCapture("D:\saga\P1060809.MOV");
- while(1){
- frame = cvQueryFrame(capture);
- if(!frame) break;
- cvShowImage("saga",frame);
- c = cvWaitKey(33);
- if(c == 27) break; //ESC退出
- }
- cvReleaseCapture(&capture);
- cvDestroyWindow("saga");
- return -1;
-
- }