OpenKinect Wrapper

Disclaimer: The OpenKinect Win32 Guide is NOT owned by Kinecthacks.com. It is the the property of as3Kinect.org. Kinecthacks.com wishes to share this guide to its viewers in order to help Kinect enthusiasts to properly use the OpenKinect Win32 Wrapper software and benefit from it. The move to feature this guide on our growing website is to give due recognition to its makers. For more information about the as3kinect.org, visit the group’s website.

Installing Drivers:

Download and extract freenect_drivers.zip or use platform/windows/inf files from the OpenKinect repo.

Open Device Manager (Control Panel -> Device Manager)

Remove any drivers for kinect if installed (NUI or OpenNI)

For each device (camera, motor, audio):

  • Right Click
  • Update Driver Software
  • Browse my computer for driver software
  • Let me pick from a list
  • Have Disk…
  • Select the corresponding driver from OpenKinect inf files

Using binaries:

Download and install: http://www.microsoft.com/downloads/en/details.aspx?familyid=A7B7A05E-6DE6-4D3A-A423-37BF0912DB84&displaylang=en (Microsoft Visual C++ 2010 Redistributable Package)

Download freenect_win_as3server_0.9c.zip, unzip it somewhere.

Then you can run as3-server.exe

How to compile (v0.9c):

Download and install git for windows: http://code.google.com/p/git-osx-installer/

Download and install cmake for windows: http://www.cmake.org/cmake/resources/software.html

Download and extract freenect_win_deps.zip somewhere. I will refer to this unziped folder as freenect_win_deps.

Download and instal Visual C++ Express 2010: http://www.microsoft.com/express/Downloads/

Note: During installing process allow cmake to be added into the system path.

Open Git Bash and download libfreenect source:

git clone git://github.com/imekinox/openkinect.git

Switch to unstable version:

cd openkinect
git checkout unstable

If this does not work try this:

cd openkinect
git branch unstable
git checkout unstable
git pull origin unstable

Generate Visual C++ project:

mkdir build
cd build
cmake -G "Visual Studio 10" ..

It will fail (but we have set cmake to generate Visual Studio 10 Solution).

Open Cmake GUI.

In Browse Source set the path to the libfreenect/openkinect source.

In the Browse Build set the same path as above but with /build appended

Then run configure and it will fail again.

This time it will show us some configuration options.

Check Advanced (Next to Grouped)

In the configuration list:

Uncheck BUILD_FAKENECT
Uncheck BUILD_CPP
Check BUILD_AS3_SERVER

Go to the bottom of the configuration options.

Set LIBUSB_1_INCLUDE to the include folder of the uncompressed freenect_win_deps.
(freenect_win_deps/include)
Set LIBUSB_1_LIBRARY to point to the libusb.lib file inside the uncompressed freenect_win_deps.
(freenect_win_deps/lib/msvc/libusb.lib)
Set THREADS_PTHREADS_INCLUDE_DIR to the include folder of the uncompressed freenect_win_deps.
(freenect_win_deps/include)
Set THREADS_PTHREADS_WIN32_LIBRARY to point to the pthreadVC2.lib file inside the uncompressed freenect_win_deps.
(freenect_win_deps/lib/pthreadVC2.lib)
Set LibJpeg_INCLUDE_DIR to the include folder of the uncompressed freenect_win_deps.
(freenect_win_deps/include)
Set LibJpeg_LIBRARY to point to the libjpeg.lib file inside the uncompressed freenect_win_deps.
(freenect_win_deps/lib/libjpeg.lib)
Run configure again.

This time it will say “Configuring done” BUT it still needs GLUT references.

At the top of the configuration options you’ll see 4 red elements.

Set GLUT_INCLUDE_DIR to the include folder of the uncompressed freenect_win_deps.
(freenect_win_deps/include NOT freenect_win_deps/include/GL)
Set GLUT_glut_LIBRARY to point to the glut32.lib file inside the uncompressed freenect_win_deps.
(freenect_win_deps/lib/glut32.lib)

Run configure again.

Now you should not have any errors.

Run generate.

Open libfreenect.sln from build folder under freenect source code.

Select “Visual C++ 2010″ (I think it does not matter which you choose here)

Press F7 or From Debug menu select Build Solution.

It should compile correctly besides the bunch of warnings.

Then inside build\bin\Debug we will find the binaries.

Now we’ll have to copy here some files before they work.

Copy freenect.dll and freenect_sync.dll from build\lib\Debug to build\bin\Debug

Copy pthreadVC2.dll form freenect_win_deps\lib to build\bin\Debug

Copy libjpeg-8.dll from freenect_win_deps\lib to build\bin\Debug

Copy glut32.dll form freenect_win_deps\lib to build\bin\Debug

Copy libusb0.dll from platform\windows\inf\xbox nui camera\amd64 to build\bin\Debug
or (if compiling for 32 bits):
Copy libusb0_x86.dll from platform\windows\inf\xbox nui camera\x86to build\bin\Debug

Then if you already installed the drivers you can run as3-server.exe