4 Replies Latest reply on Oct 3, 2016 1:43 PM by Yeong

    Unable to open webcam on Intel Edison

    Yeong

      Hi everyone,

       

      Currently, I'm doing a project about image processing on Intel Edison kit for Arduino. A webcam is attached to Intel Edison. The webcam must be able to capture the image, then send to another computer (Ubuntu OS). Video streaming is also needed. Below is the detail of my project.

       

       

      Intel Edison image: edison-image-ww05-15

      Downloaded from http://downloadmirror.intel.com/24909/eng/edison-image-ww05-15.zip

      I'm using this image because it is already has kernel-module-uvcvideo installed.

       

       

      Webcam: Logitech C270h HD webcam (It is Linux & UVC-compatible)

       

       

      Output after running  dmesg -c :

      Screenshot from 2016-09-29 00-50-03.png

       

      Screenshot from 2016-09-29 00-47-00.png

       

      Screenshot from 2016-09-29 00-51-14.png

       

      Screenshot from 2016-09-29 01-41-47.png

       

       

       

      I have written a C++ code in openCV and compiled it as executable file. The C++ coding (webcam.cpp) as follow:

      #include <opencv2/highgui/highgui.hpp>
      #include <opencv2/imgproc/imgproc.hpp>
      #include <iostream>
      using namespace cv;
      using namespace std;
      
      int main() {
      VideoCapture stream1(0);   //0 is the id of video device
      
      if (!stream1.isOpened()) { //check if video device has been initialised
      cout << "cannot open camera";
      }
      
      while (true) {
      Mat cameraFrame;
      stream1.read(cameraFrame);
      imshow("cam", cameraFrame);
      if (waitKey(30) >= 0)
      break;
      }
      return 0;
      }
      

       

       

      When I open the executable file (webcam), it gives this error: (cam:2050): Gtk-WARNING **: cannot open display:

      Screenshot from 2016-09-29 01-38-38.png

       

       

      As I know, Intel Edison does not have a video out (as described here). The error is occurred as I call functions related to 'display on the screen' such as 'imshow' which creates and displays an image or a video on the screen.

       

       

      Anyone has idea to solve this problem?

       

      It does not necessary to display image on Intel Edison but it must be able :

      to capture image and send to another computer (native Ubuntu OS).

      live video streaming (can view it on another computer)

       

       

      I have an idea for video streaming but I am not sure how to do it. Connect both Intel Edison and computer to same network. The webcam acts like a IP camera. To stream video, I will create a C++ coding in openCV to call the IP address and port number. One more thing i'm not sure is how to check the port number.

      Note: I won't use the web browser to view it because I need to integrate the C++ coding with some image processing algorithms.

      Is this the solution?

       

      Do you have better suggestion to implement it?

       

       

      Thank you in advance!