标签:
0.下载IP摄像头(android软件)并安装
比如这个(图标是一个灰色的摄像头的那个软件)
1.新建cpp文件,编译
#include "opencv2/opencv.hpp" #include <iostream> using namespace std; using namespace cv; int main(){ VideoCapture capture("http://192.168.0.100:8080/video?dummy=param.mjpg"); if(!capture.isOpened())cout<<"fail to open"<<endl; else cout<<"Success!!!!!!!!!!!"<<endl; return 0; }
注意里头的红色字符串!!一定一定要加!!!否则就是出错!!!我找了好久的原因最后发现因为这个!!!
加它的原因:
OpenCV expects a filename extension for its VideoCapture argument, even though one isn‘t always necessary (like in your case).
You can "trick" it by passing in a dummy parameter which ends in the
mjpg
extension:
意思就是:
虽然我们的ipCamera没有后缀,但是OpenCV很傻,一定要一个.mjpg之类的后缀才认,所以就骗它,这么加一个
(2.如果不怎么做就会报错)
warning: Error opening file (../../modules/highgui/src/cap_ffmpeg_impl.hpp:545)
3.参考资料
http://stackoverflow.com/questions/7266256/how-to-get-mjpg-stream-video-from-android-ipwebcam-using-opencv
google search: "opencv android ip camera"
花了我两天时间折腾啊!!!
标签:
原文地址:http://www.cnblogs.com/turtlegood/p/4306768.html