2 Replies Latest reply on Oct 5, 2016 3:24 PM by jonathan_intel

    How to write the C++ coding in openCV to stream video from IP address?


      Hi everyone,


      I'm writing a C++ coding in openCV to stream video from IP address but it doesn't work. Please help.

      Thank you.


      #include <opencv/cv.h>  
      #include <opencv2/highgui/highgui.hpp>  
      #include <opencv2/imgproc/imgproc.hpp>  
      #include <iostream>  
      #include <stdio.h>  
      using namespace std;  
      using namespace cv;  
      int main()  
          Mat frame;  
          namedWindow("video", 1);  
          VideoCapture cap("");  
              cout<<"Camera not found"<<endl;  
              return -1;  
          while ( cap.isOpened() )  
              cap >> frame;  
              if(frame.empty()) break;  
              imshow("video", frame);  
              if(waitKey(30) >= 0) break;  
          return 0;  






      For line 12, I also tried:


      cv::VideoCapture cap("ws://");


      VideoCapture cap("");


      cv::VideoCapture capture("http://user:password@");




      I confirmed the IP address and port number are correct because I can view the video using web browser.