ofxKinect on Windows. Compiling/running but not working

Hi guys,

I am at a dead end right now and I really need some help with the ofxKinect extension (for windows) using CodeBlocks (mingw gcc compiler).

Ok. So I spent a couple of hour banging my head against the keyboard until I solved all of the gazillion problems along the road.

I updated to the latest libfreenect that is supped to work with windows and also the libusb-1.0 (windows_backend lib).

I did an example project for CodeBlocks in the openframeworks example folder called “kinectExample” (see attachment) and finally got it to compile and run.

But of course it does not work. I get a:

Could not open camera: -12
OF_ERROR: ofxKinect: Could not open device

The libfreenect driver is installed and working. I have checked that with a couple of precompiled binaries that I got a hold of.

So there seems to be something wrong in the libusb part I guess. (?). I do get some warnings regarding this part when I compile but it’s nothing that I can make sense of right now.

Any help would be appreciated.



I’ve managed to compile it under Windows, using Visual Studio and it kinda works… I can control the motor and read the accelerometer. All I get from the cameras is glitch (http://forum.openframeworks.cc/t/ofxkinect-on-windows/5503/0)

I don’t think I’ve ever had the error you mention, though…

Have you added Windows-specific stuff in the ofxKinect folder? (like freenect compiled lib, or stuff from windows/iibusbemu)… I suppose you have, but you never know :wink:

(I’m not sure why there’s #include <libusb.h> in ofxKinect.h, as I thought only libfreenect would deal with it… it might be something confusing our Windows builds)

Hi guys!

I’m having the same error. I’m running win 7 64 bits and using codeblocks.

* I have libfreenect drivers installed properly from:

* The project compiles and runs just fine! but then I get:

OF: OF_VERBOSE: ofxKinect: Context inited
OF: OF_VERBOSE: ofxKinect: Number of devices found: 1
OF: OF_VERBOSE: ofxKinect: Number of available devices: 1
Could not open camera: -12
OF: OF_LOG_ERROR: ofxKinect: Could not open device 0
OF: OF_VERBOSE: ofxKinect: Context cleared

Process returned 0 (0x0) execution time : 2.539 s
Press any key to continue.

* I think the issue is related to libusb. Digging into the code I’ve found that when it calls in kinect.open() ends up calling to fnusb_open_subdevices in line 81 (ofxKinect/libs/libfreenect/core.c) and it is returning -1.

Do I have to install something special to have libusb support?

I’ll attaching the code just in case someone can help :).

* The strange part is that this example (not from openframeworks) works perfectly:

Thanks in advance!


Actually, as the readme states, you should try using the drivers included with ofxKinect in lib/libusb/win.

I’m new to PC, how exactly do I “use” those drivers? Do I need to move them to a specific folder on my machine?

Uh, from the readme:

Precompiled libfreenect drivers and libusb-win32 libs are included for Windows.

Make sure to install or update the libfreenect Kinect camera, motor, and audio drivers through Windows Device Manager by pointing it to the driver folder:


You may need to manually update each driver individually if you’ve plugged it in before. ofxKinect will not work if the drivers are not installed.

Sorry if it seems like I wasn’t doing my homework. I was totally new to the whole windows device manager, file browser situation.

There also is an extra step, as my PC automatically installed the microsoft drivers when I plugged the kinect in. Once that happens Windows will not let you “update” the driver to the libfreenect ones. You need to find and delete the three drivers, unplug the kinect, plug it back in, stop it from auto installing the drivers (which can be fast), then point it to the proper drivers in ofxKinect.