opencv讀取視頻文件的圖片幀

#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;
}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章