2017-09-04 37 views
1

我无法访问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警告:打开文件时出错(/build/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:578)

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

cv::VideoCapture capVideo; 
const std::string videoStreamAddress = "http://admin:[email protected]: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 
} 

回答

0

我已经解决了这个问题,事实证明,我对视频流的地址不正确的URL,难的是我的相机是不是已知的,不得不有关如何配置它一点单证。我使用ispy应用程序为我的kedacom相机生成了一个合适的URL,并在VLC和应用程序以及中提琴上进行了测试!有效。