Thursday, May 19, 2016

OpenCV Libfreenect and Spyder Python

Last few hours were a total waste due to unskilled googling !!

Setup a kinect in Ubuntu 12.04 and connected with Spyder.


With the above tutorial you can have a nice visualization with the Kinect from your Linux/Ubuntu Terminal. I believe you will have a "libfreenect " folder by now built in your installation destination.

The next step is to interface "libfreenect" with "Spyder"

  1.  Open the "Wrappers" folder in your "libfreenect" installation.
  2.  Enter into "Python 2" folder and copy "freenect.py"



  3.  Enter "Anaconda2" installation folder and open "lib" folder


      4. Python 2.7 contains all the supporting library files for accessing. If you are a Windows user, you paste your opencv file "cv2.pyd" in the same following steps



      5. Select - Site packages and copy the "freenect.py" file into "site package"




       6. As soon as this is done you can restart "Spyder" in terminal and access freenect by

    $ import freenect


    Anaconda2 is kinda really cool. You just install using "conda". The steps are:

    $ cd ~/anaconda2/

    $ conda install --channel https://conda.anaconda.org/menpo opencv3

    Ref: http://stackoverflow.com/questions/23119413/how-to-install-python-opencv-through-conda


    This will install OpenCV3. I would recommend you to follow this step. It will save you a ton of time. And avoid just using "conda install opencv" as by default opencv 2.4.10 is installed with some messed up build with CMakeList switching off GTX and other stuff. Also avoid to manually "make" from the opencv setupfile. This is just for beginners like me.
    You can access opencv in Spyder

    $ import cv2
     Hope you saved some time !!! If somethings went wrong you know where to go --> Stackoverflow as usual !!!

    2 comments: