opencv无法播放视频

opencv无法播放视频
可以打开摄像头,就是没办法打开视频

img

img

你的代码有问题
参考下面的代码, 望采纳!

#include<iostream>
#include<opencv2/opencv.hpp>
using namespace cv;
 
int main()
{
  VideoCapture capture;
  Mat frame;
  frame= capture.open("E:/image/a1.avi");
  if(!capture.isOpened())
  {
    printf("can not open ...\n");
    return -1;
  }
  namedWindow("output", CV_WINDOW_AUTOSIZE);
 
  while (capture.read(frame))
  {
    imshow("output", frame);
    waitKey(10);
  }
  capture.release();
  return 0;
}