OpenCV打开摄像头
直接上代码。代码功能就是打开摄像头。其他功能以后再慢慢添加。
此处使用的版本为OpenCV 3.0.0,编译工具为MS VS 2013,摄像头是笔记本自带的。
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/core/core.hpp>
using namespace cv;
int main()
{
VideoCapture cap(0);
if (!cap.isOpened())
{
return -1;
}
Mat frame;
bool stop = false;
while (!stop)
{
cap >> frame;
im