opencv (2)取得摄像头或者视频

#include <opencv2\opencv.hpp>
using namespace cv;
using namespace std;

int main()
{
//读取视频或摄像头
VideoCapture capture(0);
//读取视频或摄像头
VideoCapture capture(“1.avi”);

while (true)
{
	Mat frame;
	capture >> frame;
	imshow("读取视频", frame);
	waitKey(30);	//延时30
}
return 0;

}

猜你喜欢

转载自blog.csdn.net/weixin_43758551/article/details/84820555