本文的目标就是实现获取摄像头视频流并且保存到本地。
代码如下:
#include "opencv2/highgui/highgui.hpp"
#include <iostream>
using namespace cv;
using namespace std;
int main(int argc, char* argv[])
{
VideoCapture cap(0); //打开摄像头
if (!cap.isOpened())
{
cout << "ERROR: Cannot open the video file" << endl;
return -1<