任何人都可以向我解釋爲什麼下面的代碼不起作用?MJPEG網絡流到OpenCV 2
#include "opencv/cv.h"
#include "opencv/highgui.h"
#include <iostream>
int main(int, char**) {
cv::VideoCapture vcap;
cv::Mat image;
const std::string videoStreamAddress = "http://hg55.no-ip.org/mjpg/video.mjpg";
//Yes, this stream does work! Try to paste it into your browser...
//open the video stream and make sure it's opened
if(!vcap.open(videoStreamAddress)) {
std::cout << "Error opening video stream or file" << std::endl;
return -1;
}
for(;;) {
if(!vcap.read(image)) {
std::cout << "No frame" << std::endl;
cv::waitKey();
}
cv::imshow("Output Window", image);
if(cv::waitKey(1) >= 0) break;
}
}
此代碼不能打開流...
的代碼是基於這個線程一些代碼:OpenCV with Network Cameras
在OpenCV 1代碼在這裏沒有任何問題對我的作品。
非常感謝你提前
您正在構建OpenCV,還是使用預編譯的二進制文件?你在哪個平臺上運行? – hatboyzero 2012-02-08 16:20:15
我正在使用Visual Studio 2010的預構建二進制文件。OpenCV版本2.3.1。 Windows 7,x64 – hansdam 2012-02-09 00:27:04