使用opencv 播放视频打开文件失败遇到的坑

今天使用opencv 来做显示视频的时候却怎么也打开视频失败,就这几行代码
调试了半天,却发现我用的是release版本的库,而我编译的是debug的,后来换了下debug库就可以了

#ifndef OPENCV_H
#define OPENCV_H
#include 
#include 
#include 
#include 
using namespace std;
using namespace cv;
int myOpencv()
{
    namedWindow("Example2", WINDOW_AUTOSIZE);
    VideoCapture cap;
    cap.open("http://ivi.bupt.edu.cn/hls/cctv5phd.m3u8");
      if(!cap.isOpened())
      {
          cout<<"can not filed"<<endl;
      }
    Mat frame;
    while (1)
    {
          cap >> frame;
        if (frame.empty())
        {
         break;
        }
        imshow("Exameple2",frame);
        if (waitKey(33) >= 0) break;
    }
    return 0;
}
#endif // OPENCV_H

你可能感兴趣的:(视音频,opencv,c++,qt)