使用opencv调用图像
#include<opencv2\opencv.hpp>
#include<iostream>
using namespace cv;
using namespace std;
int main(int argc, char**argv)
{
string path = "resources/test.png";
Mat src = imread(path);
imshow("input", src);
waitKey(0);
destroyAllWindows();
return 0;
}
调用视频
int main(int argc, char**argv)
{ string path = "resources/test_video.mp4";
VideoCapture cap(path);
Mat img;
while (true)
{
cap.read(img);
imshow("input", img);
waitKey(5);
}
网络摄像头
int main(int argc, char**argv)
{
VideoCapture cap(0);
Mat img;
while (true)
{
cap.read(img);
imshow("input", img);
waitKey(5);
}