OpenCV 串連 Android IP網路攝影機

來源:互聯網
上載者:User

標籤:

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"

 

花了我兩天時間折騰啊!!!

OpenCV 串連 Android IP網路攝影機

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.