Building on Windows

Dustin Freeman edited this page Jul 24, 2013 · 10 revisions

This is a community-contributed wiki. Feel free to improve it or post an issue if you have questions or troubles.

As many operations involved in the build process are lengthy ones (setting up Windows, installing system updates, installing Visual Studio Pro, building/installing the Boost library), the whole process can take a couple of days to complete, depending on what you already have installed.

Make sure the device (Kinect, etc.) is unplugged before starting the installation.

Installing OpenNI

  1. Download the OpenNI installer here.
    Select OpenNI Binaries, Unstable, and your OS option.

  2. Now, install the drivers for your device:

    • If you have an Asus Xtion Pro, download Sensor installer from here.
      Select OpenNI Compilant Hardware Binaries, Unstable, and your OS option.
    • If you have a Microsoft Kinect, download SensorKinect installer from here.
       
  3. With this, we should be able to communicate with the device.
    If we want to do more interesting things like track skeleton, track hands, detect users, poses and gestures we need some middleware.

    So, download the middleware installer from here.
    Select OpenNI Compilant Middleware Binaries, Unstable, and your OS option.

That's it, you have the OpenNI stack installed! To try, plug the device and go to Start Menu → PrimeSense → NITE → Samples → Sample-PointViewer. Go in front of the camera and wave your hand! Other samples can be found on the same menu.

Install the compiler

Of course, we'll need a compiler. We could use MinGW,
but it's currently not possible due to incompatibilities
with OpenNI.

So, install Visual Studio 2010 Pro (DVD and online updates).
Make sure the "VC++ compiler" option is checked.
Other languages (Visual Basic, C#, F#, etc.) can be left out.

Install PyOpenNI dependencies

PyOpenNI are the bindings that will allow you to use OpenNI from Python.
To build it, we'll need to install first:

  1. CMake from its website

    → Accept the default location. Add to PATH for all users.

  2. Git for Windows from Google Code (full installer)
    The default options are fine.

  3. Python (of course) from its homepage
    You should have version 2.7 or later.

    → We accept the default location, C:\Python27.

  4. The Boost set of C++ libraries
    Get an installer from here.

    
    

Download & Build PyOpenNI

  1. Open a Git shell (Start Menu → Git → Git Bash) and type:

    git clone https://github.com/jmendeth/PyOpenNI.git

    Then close the git-shell window.

  2. Open a command prompt (Start Menu → Accessories → Command Prompt) and type:

    md PyOpenNI-build
    cd PyOpenNI-build
    cmake -G "Visual Studio 10" ..\PyOpenNI

    No warnings or errors should appear.

  3. Open the `PyOpenNI-build` folder and double-click on `PyOpenNI.sln`. Visual Studio will then be launched.
  4. In the “Solution Configuration” dropbox, select Release.

  5. Generate the solution by pressing the F7 key.

Install PyOpenNI

Open the PyOpenNI-build folder. Inside lib, there should be the finished module, openni.dll

:: copy Boost-python 
cp C:\boost\stage\lib\boost_python-vc100-mt-1_51.dll C:\Python27\Lib\site-packages

:: copy and rename openni.dll
cp bin\Release\openni.dll C:\Python27\Lib\site-packages\openni.pyd

Now, open Python and try:

import openni

No error message should be displayed.