#include <opencv2\opencv.hpp> #include <iostream> #include <stdio.h> using namespace std; int main() { // IP Webcam for android with smartphone camera // 1. install IP WebCam app to smartphone // 2. run IP WebCam it, will show IP address and port number. // 3. combines ip address & port number and some parameters like a under following. const std::string ip_webcam_for_android("http://IPアドレス/video?dummy=param.mjpg"); cv::VideoCapture cap(ip_webcam_for_android); if (!cap.isOpened()) { cout << "Camera not found" << endl; getchar(); return -1; } cv::Mat frame; cv::namedWindow("input", 1); while (cap.isOpened()) { cap >> frame; if (frame.empty()) break; cv::imshow("input", frame); if (cv::waitKey(30) >= 0) break; } return 0; }
AndroidのIP webcamを使用し、無線LANを使用してPC上で表示しています。
Visual Studio 2015 , OpenCV3.1を使用してURLによるMJPGストリームを取得しようと思っているのですが if (!cap.isOpened()) のところで失敗しています。
どう改善したらいいのでしょうか?
よろしくお願いします。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。