Notice: MediaWiki has been updated. Report any rough edges to marcan@marcan.st
CSharp Wrapper
This effort will provide a wrapper to access the Kinect through C#. The wrapper is pretty much done (see Image below).
The C# wrapper is currently feature complete. But the win32 version of libfreenect has a lot of issues. In order to keep support issues down and reduce confusion etc. the C# wrapper will not be put into the mainline until the win32 version of libfreenect is working. The version that does work in linux can be found at: https://github.com/lostincake/libfreenect/tree/csharp_wrapper Please understand however, that this is not an official release yet. But you are welcome to play with the code. If you have any questions, you can try contacting Aditya (LostInCake).
About
Who is involved
Coordinator/Development: Aditya Gaddam (User:LostInCake)
Current Status
Feature | Supported? | Notes |
---|---|---|
Connect to Kinect (heh) | Yes | |
Control LED | Yes | 0x04 and 0x05 for the LED status seem to do the same thing - Blink Green. Seems to be something on the native lib side though. |
Control motor | Yes | |
Get accelerometer data | Yes | |
RGB data callback | Yes | |
Depth data callback | Yes |
Media
Installation/Configuration
Quick getting started:
Open up the KinectDemo Solution in Visual Studio, then build - it will fail compaining about being unable to open libfreenect. Go to wherever your build files ended up from building libfreenect - mine are in D:\Kinect\build32\bin\debug, and copy all of the files to the csharp wrappers bin folder - mine is D:\Kinect\lostincake-libfreenect-3251748\wrappers\csharp\bin. After that mine ran, although I only got one video frame, and a complaint about a function call. It was nice to see the one frame though.
Sample Code
using LibFreenect;
...
// Getting device count
Console.WriteLine("Number of devices = " + Kinect.DeviceCount);
if(Kinect.DeviceCount > 0)
{
// Connecting to a device
Kinect k = new Kinect(0);
k.Open();
// Setting LED color
k.LED.Color = KinectLED.ColorOption.Yellow;
// Closing connection
k.Close();
}
// Shutdown library and close any open devices
// Should probably do this at the end of every program.
Kinect.Shutdown();