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 themjpgextension:

意思就是:

虽然我们的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"

花了我两天时间折腾啊!!!

更多相关文章

  1. Android(安卓)前置摄像头的默认是180度,导致应用拍照和录制视频是
  2. Android(安卓)摄像头后台采集
  3. Android开发错误信息收集
  4. 【android】Error: Static interface methods are only supporte
  5. 两个星期的Android开发
  6. Android(安卓)Sqlite Failed to open database(无法打开数据库文
  7. Android(安卓)studio b Error: No resource found that matches
  8. Android(安卓)Studio编译报错:sdk:minSdkVersion 1 cannot be sma
  9. (Android(安卓)jni) error: base operand of '->' has non-pointer

随机推荐

  1. 教你用php实现栈结构
  2. PHP实现抓取百度搜索结果,并分析数据结构
  3. 分享十个PHP安全的必备技巧
  4. PHP协程框架Hyperf日志查看组件
  5. 解析PHP标准库SPL数据结构
  6. 创建 PSR-4 的 Php 包
  7. 看看PHP 多进程处理任务
  8. 一定要改掉 这5个PHP编程中的不良习惯!
  9. PHP安全问题汇总
  10. 详解PHP中被忽略的性能优化利器:生成器