Ei nyt ihan 3d kamaa, mutta tarpeeksi lähellä

. Koska näitä Kinect drivereita on nykyisin kivasti saatavilla ja moinen kapistus on tullut hommattua niin pitihän sitä kokeilla itsekin koodailla Kinect softa

.
Softa käyttää CL NUI Platformia.
http://codelaboratories.com/kb/nuiHomma on varsin simppeliä.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;
using System.Runtime.InteropServices;
using System.Windows.Interop;
using System.Threading;
using System.Diagnostics;
namespace KinectTest
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
private NUIImage nuiDepth = null;
private IntPtr camera = IntPtr.Zero;
private string strSerial = null;
public MainWindow()
{
InitializeComponent();
int iDevCount = CLNUIDevice.GetDeviceCount();
if (iDevCount != 1)
{
MessageBox.Show("More than one Kincet device detected. This software have support only one device.");
Environment.Exit(0);
}
strSerial = CLNUIDevice.GetDeviceSerial(0);
camera = CLNUIDevice.CreateCamera(strSerial);
CLNUIDevice.StartCamera(camera);
}
private void image1_Loaded(object sender, RoutedEventArgs e)
{
nuiDepth = new NUIImage(640, 480);
image1.Source = nuiDepth.BitmapSource;
}
private void button1_Click(object sender, RoutedEventArgs e)
{
takeSnapshot();
}
private void takeSnapshot()
{
CLNUIDevice.GetCameraDepthFrameRGB32(camera, nuiDepth.ImageData, 500);
Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)delegate()
{
nuiDepth.Invalidate();
});
}
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
CLNUIDevice.StopCamera(camera);
}
}
}
Tämän lisäksi tarvitaan pari wrapperiä, jotka tulee onneksi CL NUI Platformin mukana.