1 Reply Latest reply on Apr 13, 2015 9:08 AM by Intel_Peter

    Video with OpenCV/Python on Edison


      I have installed Python 2.7 and OpenCV2 on my Edison and am trying to verify that Python can at least open and verify that it can see one frame (I know there is no way to see the frame with the Edison).


      The code I am using is:

      import cv2

      cap = cv2.VideoCapture(0) --or--  cap = cv2.VideoCapture(some file path to the sdcard)

      ret, img = cap.read()


      No error is given in Python, so it recognizes the commands, I assume.

      Then I do:

      print ret

      which returns: false(not open)


      I also do:


      which gives me the error: AttributeError: 'NoneType' object has to attribute 'size', meaning there is no image.


      Does anyone have experience with image processing on the Edison with Python. Long story short, we need to use Python for this particular code to detect people in the frames.


      Also, the camera is recognized as a UVC video device


      Thank you

        • 1. Re: Video with OpenCV/Python on Edison

          Hello LukeP,


          Did you make sure to install the OpenCV's bindings for Python?

          I tried the following code and I were able to get the size of a .jpg file:


          import cv2
          img = cv2.imread('opencv.jpg')
          h, w, d = img.shape                                      #h,w and d stand for Height, Weight and Shape
          print h, w, d
          600 800 3                                                          #these are the Height, Weight and Shape values for my .jpg file


          I know that you want to read a frame from a video, but in order to do it you have to get the frame and make it a picture, than you can manipulate it like this.