5 Replies Latest reply on Oct 12, 2016 3:29 PM by Intel Corporation

    How to Capture Video Stream from Edi-Cam Server using C++ in openCV?

    Yeong

      Hi everyone,

       

      I am trying to do some processing on video being streamed from an Edi-Cam server (GitHub - drejkim/edi-cam: Video streaming on Intel Edison) which is written in nodejs.

      Is it possible for me to capture video stream from Edi-Cam Server using C++ in openCV?

       

       

      The C++ coding that i wrote as follow:

      #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("http://192.168.8.102:8080/video.mjpg");  
          if(!cap.isOpened())  
          {  
              cout<<"Camera not found"<<endl;  
              getchar();  
              return -1;  
          }  
          while ( cap.isOpened() )  
          {  
              cap >> frame;  
              if(frame.empty()) break;  
              imshow("video", frame);  
              if(waitKey(30) >= 0) break;  
          }     
          return 0;  
      }
      
      

       

       

       

       

      When running the C++, it does not show me the video and show me "Camera not found".

      However, in Intel Edison terminal, it shows:
      "GET /video.mjpg 206 87.816 ms - 1248"

      Screenshot from 2016-10-01 18-26-32.png

       

       

       

       

      Thank you.