opencv打开摄像头
opencv打开摄像头
#include <opencv2/opencv.hpp> #include <iostream> using namespace cv; using namespace std; int main() { cv::namedWindow("win1", cv::WINDOW_AUTOSIZE); VideoCapture capture1(1); //capture1.get(cv::CAP_PROP_FRAME_WIDTH); //capture1.get(cv::CAP_PROP_FRAME_HEIGHT); capture1.set(cv::CAP_PROP_FRAME_WIDTH, 1920); capture1.set(cv::CAP_PROP_FRAME_HEIGHT, 1080); Mat img1; while (capture1.isOpened()) { bool isSuccess = capture1.read(img1); if (isSuccess) { imshow("win1",img1); } std::cout << img1.cols<<" "<<img1.rows << std::endl; waitKey(1); } return 0; }
#####################
QQ 3087438119