opencv读取视频文件的图片帧

    技术2026-04-02  15

    #include <iostream> //#include <opencv2/opencv.hpp> #include <opencv2/highgui.hpp> #include <opencv2/videoio.hpp> #include <opencv2/imgproc.hpp> using namespace cv; using namespace std; //debug下在lib文件的名称后加d,release下不加d。 int main() { VideoCapture capture("../res/正则入门111.wmv"); /*capture.open("../res/vtest.avi");*/ while (1) { Mat frame; capture >> frame; //读取当前帧 if (frame.data == NULL) break; imshow("读取视频的当前帧", frame); if (waitKey(30) >= 0) break; } capture.release(); return 0; }

    Processed: 0.010, SQL: 9