基本信息
源码名称:OpenCV打开本地摄像头并显示
源码大小:0.52KB
文件格式:.cpp
开发语言:C/C++
更新时间:2015-08-18
   源码介绍


OpenCV打开本地摄像头并显示

#include <iostream>
#include <opencv.hpp>
#include <Windows.h>

using namespace std;
using namespace cv;

#pragma comment(lib, "opencv_core246.lib");
#pragma comment(lib, "opencv_video246.lib");
#pragma comment(lib, "opencv_highgui246.lib");

int main()
{
    VideoCapture capture;

    capture.open(0);

    Mat frame;

    if (capture.isOpened())
    {
        while (1)
        {
            capture >> frame;
            imshow("test", frame);
            cvWaitKey(33);
        }
    }
    return 0;
}