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;
}

  


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM