学OpenCV
================================================
简单的看下效果。
================================================
1 #include <iostream> 2 #include <opencv2/opencv.hpp> 3 #include <opencv2/core/utils/logger.hpp> 4 5 int main() 6 { 7 cv::utils::logging::setLogLevel(cv::utils::logging::LOG_LEVEL_ERROR); 8 9 double fps=1; 10 11 cv::VideoCapture video(R"(C:\testNoGit\learnOpenCV4-master\data\cup.mp4)", cv::CAP_ANY); 12 //cv::VideoCapture video(R"(C:\TDownload\The.Advisors.Alliance.2017.E19.WEB-DL.1080p.H264.AAC-Xiaomi.mp4)", cv::CAP_ANY); 13 if (video.isOpened() == true) 14 { 15 std::cout<<"width: " << video.get(cv::CAP_PROP_FRAME_WIDTH) << std::endl; 16 std::cout<<"height:" << video.get(cv::CAP_PROP_FRAME_HEIGHT) << std::endl; 17 std::cout << "fps:" << video.get(cv::CAP_PROP_FPS) << std::endl; 18 std::cout << "frames:" << video.get(cv::CAP_PROP_FRAME_COUNT) << std::endl; 19 20 fps=video.get(cv::CAP_PROP_FPS); 21 } 22 else 23 { 24 std::cout << "please check the file name and path." << std::endl; 25 return -1; 26 } 27 28 cv::Mat frame; 29 for (;;) 30 { 31 video >> frame; 32 if (frame.empty()) 33 { 34 break; 35 } 36 37 cv::imshow("cup", frame); 38 cv::waitKey(1000 / fps); 39 40 } 41 42 cv::waitKey(); 43 44 return 0; 45 }
标签:视频,显示,cup,frame,video,include,cv,utils,加载 From: https://www.cnblogs.com/wlsandwho/p/18367100