c++ - 警告 : Error opening file (/build/opencv/modules/videoio/src/cap_ffmpeg_impl. hpp:578)

标签 c++ opencv ip-camera

我无法在 opencv 上访问 ipcamera,我正在使用 ipcctrl 应用程序查看相机预览并且它工作正常,但是当我尝试将 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
}

最佳答案

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

关于c++ - 警告 : Error opening file (/build/opencv/modules/videoio/src/cap_ffmpeg_impl. hpp:578),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46030963/

相关文章:

c++ - 多态性 - 如何访问派生类的方法?

c++ - 模板参数是如何展开的

image-processing - 将多个 Haar 分类器与 OpenCV 相结合

c++ - LibRaw 和 OpenCV

python-3.x - 使用 OpenCV 访问网络摄像机

c++ - C++控制网络摄像机的云台功能

OpenCV IP 摄像机图像恶化

c++ - 模板化隐式类型转换运算符

c++ - 复制构造函数不是深度复制,错误返回数组为空

opencv - 如何查看 OpenCV 构建信息