open cv抓去视频

来源:互联网 发布:手机域名怎么注册 编辑:程序博客网 时间:2024/06/08 05:08

利用open cv读取视频源码

#include "highgui.h"



int main( int argc, char** argv ) { 
    cvNamedWindow( "Example2", CV_WINDOW_AUTOSIZE );
    //CvCapture* capture = cvCaptureFromAVI( argv[1] ); // either one will work      argv[1]//视频地址
    CvCapture* capture = cvCreateFileCapture( argv[1] );
    IplImage* frame;
    while(1) {
        frame = cvQueryFrame( capture );
        if( !frame ) break;
        cvShowImage( "Example2", frame );
        char c = cvWaitKey(33);
        if( c == 27 ) break;
    }
    cvReleaseCapture( &capture );
    cvDestroyWindow( "Example2" );
}
0 0
原创粉丝点击