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