OpenCV 学习笔记(5) 使用opencv打开笔记本摄像头

#include "stdafx.h"
#include <opencv2\opencv.hpp>
#include <iostream>
#include <string>
using namespace cv;
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
cvNamedWindow("我的摄像头", CV_WINDOW_AUTOSIZE);
//captue = cvCaptureFromCAM(0);
VideoCapture captue(0);//创建一个摄像头对象并且指定摄像头编号,只有一个写0就可以
//captue = cvCreateCameraCapture(0); Mat frame;
while (1)
{
captue >> frame;
imshow("我的摄像头", frame);
waitKey(30);
}
return 0;
}

  

上一篇:Android中加载位图的方法


下一篇:Linux下使用Opencv打开笔记本摄像头