#include<opencv2/core/core.hpp>
#include<opencv2/highgui/highgui.hpp>
#include<iostream>
using namespace std;
using namespace cv;
Mat getFrame(string avipath, int id)
{
Mat frame;
VideoCapture capture(avipath);
capture.set(CV_CAP_PROP_POS_FRAMES, id);
if (!capture.grab())
{
cout << "grab in opencv failed!" << endl;
return frame;
}
capture >> frame;
return frame;
}
int main()
{
Mat mou;
mou = getFrame("C:/Users/Administrator/Desktop/1.mp4",23000);
imshow("sdfg",mou);
waitKey();
}
opencv 读取任意帧
最新推荐文章于 2024-06-06 20:11:16 发布