2017-09-04 38 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和應用程序以及中提琴上進行了測試!有效。