警告:打开文件时出错(/build/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:578)

时间:2017-09-04 05:49:10

标签: c++ opencv ip-camera

我无法在opencv上访问ipcamera,我正在使用ipcctrl app来查看相机预览并且工作正常,但是当我尝试将URL粘贴到我的代码中时,它会显示警告:打开文件时出错(/ build / opencv / modules / videoio / src / cap_ffmpeg_impl.hpp:578)这里有什么问题?here is the proof that it is working fine in ipcctrl

cv::Mat imgFrame1;
cv::Mat imgFrame2;

cv::VideoCapture capVideo;
const std::string videoStreamAddress = "http://admin:admin@192.168.8.50:8088/mjpeg.cgi?user=USERNAME&password=PWD&channel=0&.mjpg";

std::vector<Blob> blobs;

cv::Point crossingLine[2];

int carCount = 0;
std::ofstream writer;
writer.open("cars.txt");
writer.close();

capVideo.open(videoStreamAddress);
if (!capVideo.open(videoStreamAddress)) {                                                 // if unable to open video file
    std::cout << "error reading video file" << std::endl << std::endl;      // show error message
    _getch();                   // it may be necessary to change or remove this line if not using Windows
    return(0);                                                              // and exit program
}

1 个答案:

答案 0 :(得分:0)

我已经解决了这个问题,事实证明我的视频流地址有一个不正确的URL,困难的部分是我的相机不是那么知道,并且有一些关于如何配置它的文档。我使用ispy应用为我的kedacom相机生成了一个正确的URL,在VLC和应用程序以及中提琴上进行了测试!它奏效了。