#include<opencv2/imgcodecs.hpp>
#include<opencv2/highgui.hpp>
#include<opencv2/imgproc.hpp>
#include<iostream>
using namespace cv;
using namespace std;
// Images图像 ///
/*
void main() {
string path = "Learn-OpenCV-cpp-in-4-Hours-main\\Resources\\test.png";
Mat img = imread(path);
imshow("Image", img);
waitKey(0);
}*/
// Video视频 ///
//void main() {
// string path = "Learn-OpenCV-cpp-in-4-Hours-main\\Resources\\test_video.mp4";
// VideoCapture cap(path);
// Mat image;
// while (true) {
// cap.read(image);
// imshow("image",image);
// waitKey(10);
// }
//}
// Webcam网络摄像头 ///
void main() {
VideoCapture cap(0);
Mat image;
while (true) {
cap.read(image);
imshow("image", image);
waitKey(10);
}
}
c++ opencv C1- Read Images Videos and Webcams
文章详细展示了如何在C++中利用OpenCV处理图片、读取视频文件和实时从网络摄像头获取视频。
摘要由CSDN通过智能技术生成