opencv 3 获取摄像头视频

按Esc退出

 

#include

#include

#include

int main( )

{

    //声明IplImage指针

    IplImage* pFrame =NULL;

 

    //获取摄像头

    CvCapture* pCapture =cvCreateCameraCapture(-1);

 

    //创建窗口

    cvNamedWindow("video",1);

 

    //显示视频

    while (1)

    {

        pFrame= cvQueryFrame(pCapture);

        if (!pFrame)break;

        cvShowImage("video",pFrame);

        char c = cvWaitKey(33);

        if (c == 27)break;

    }

    cvReleaseCapture(&pCapture);

cvDestroyWindow("video");

return0;

}



你可能感兴趣的:(树莓派)