演示:读取一个视频,然后播放,ESC退出。
-
#include "stdafx.h"
-
#include <opencv2/core/core.hpp>
-
#include <opencv2/contrib/contrib.hpp>
-
#include <opencv2/highgui/highgui.hpp>
-
#include <opencv2/imgproc/imgproc.hpp>
-
#include <opencv2/objdetect/objdetect.hpp>
-
-
using namespace cv;
-
using namespace std;
-
#pragma comment(linker, "/subsystem:\"windows\" /entry:\"mainCRTStartup\"")
-
int main(int argc, char** argv[])
-
{
-
cvNamedWindow("Example2", CV_WINDOW_AUTOSIZE);
-
CvCapture* capture = cvCreateFileCapture("F:\\life\\opencv\\BuildingCordovaAppsWithVS_high.mp4");
-
-
IplImage* frame;
-
while (1)
-
{
-
frame = cvQueryFrame(capture);
-
if (!frame) break;
-
cvShowImage("Example2", frame);
-
char c = cvWaitKey(33);
-
if (c == 27) break;
-
}
-
-
cvReleaseCapture(&capture);
-
cvDestroyWindow("Example2");
-
-
return 0;
-
}
|
![](https://i-blog.csdnimg.cn/blog_migrate/d1551a52a9a85f5a27f4aafe1e9d4ef7.png)
转载于:https://www.cnblogs.com/pengzhen/p/4951724.html