How To: Build OpenKinect/LibFreenect in Linux

The Kinect just came out in Australia today, so I’m already a little bit late to the party, but I’m keen to see what I can do with it so I went and picked one up earlier – a couple of minutes after unboxing and it’s happily working with Linux. Awesome =D

The GLView example running on LibFreenect
The GLView example running on LibFreenect

Anyways, here’s what you need to do to build the library for yourself:

  1. Using synaptic or apt-get, install the following packages: libusb1.0-dev, freeglut3-dev, git, cmake
  2. It’s possible you may need to install some other packages as well depending on what you currently have or don’t have installed, but if you need anything additional then cmake will let you know about it when you get to that step.

  3. Download the libFreenect source code using git (this will make a directory for you called libfreenect):

  4. Make a directory inside the c folder where you’ve downloaded the libFreenect source code and use cmake to configure the build:

  5. Actually compile the library:

That’s it – you’re done!

Now you can check out what the kinect’s seeing by going into the examples directory (which will now exist at ~/libfreenect/build/examples) and running ./glview as root:

I think we’re going to have a lot of fun with this… =D

6 thoughts on “How To: Build OpenKinect/LibFreenect in Linux”

    1. Take a look at the depth_cb function in the glview.c source code (in examples/glview.c). It’s pretty low-level code, but it works.

      If you wanted a higher-level interface you could try OpenCV.

  1. Hi,
    i installed libfreenect and the sample is running. How can i run a sample .c file that i have modified?
    I need the glpclview!

    1. Compile it! Have a look at the makefile to see which libraries are included and how it’s compiled, or take a look here for a starter on using gcc:

      Another thing you could do if you just wanted to get it built, and not worry about the how and why, would be to take a copy of the folder, modify their code sample and rebuild the sample using their own makefile.

      The correct way to do it though is to grab an IDE like Code::Blocks or such, and (with no offence meant) learn how to use it!

      Hope this helps!

Leave a Reply to r3dux Cancel reply

Your email address will not be published.