任何人都可以向我解释为什么下面的代码不起作用?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