opencv-读取并播放视频

#include “pch.h”
#include
#include <opencv2/opencv.hpp>
using namespace cv;

int main()
{
VideoCapture capture;
capture.open(“C:/Users/csh/Desktop/2.avi”);
while (1)//利用循环把每一帧显示出来
{
Mat frame;//用于储存每一帧的图像
capture >> frame;//读取当前帧
imshow(“视频”, frame);
waitKey(30);//延时30ms
}
return 0;

}

/VideoCapture读入视频的两种方法
VideoCapture cpature;cpature.open("");
VideoCapture capture("");
调用摄像头只需把路径改为0
/

视频播放截图

猜你喜欢

转载自blog.csdn.net/weixin_44270056/article/details/86593944