bjxqmy
VideoCapture 读入视频的方法有两种:

①先实例化再初始化:
VideoCapture capture;
capture.open("C:/Users/齐明洋/Desktop/1.mp4")

②实例化的同时进行初始化
VideoCapture capture("C:/Users/齐明洋/Desktop/1.mp4");

这两种写法的区别就如定义一个 int 类型的变量一样;
“int a;a=1;”
“int a=1;”

视频读入到 VideoCapture 类对象之后,紧接着用一个循环将每一帧显示出来。
代码:

#include<opencv.hpp> using namespace cv; int main() { VideoCapture capture("C:/Users/齐明洋/Desktop/1.mp4");
while (1) { Mat frame; capture >> frame;
imshow("读取视频", frame);
waitKey(1); } }

 效果:

 

 

分类:

技术点:

相关文章:

  • 2021-05-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-03
  • 2021-07-31
  • 2021-10-14
猜你喜欢
  • 2021-05-01
  • 2021-12-15
  • 2021-12-16
  • 2022-01-23
  • 2022-01-19
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案