SKILL BUILDER KINECT HACKING
makeprojects.com/v/29
F
G
<Window x:Class="KinectWeatherMap.;
;MainWindow"
xmlns=" http://schemas.microsoft.com/;
;winfx/2006/xaml/presentation"
xmlns:x=" http://schemas.microsoft.com/;
;winfx/2006/xaml"
xmlns:local="clr-;
;namespace:KinectWeatherMap"
Title="Kinect Weather Map"
WindowState="Maximized">
<Grid>
<local:GifImage x:Name="weatherImage"/>
<Image Name="kinectImage"
Stretch="Uniform" />
</Grid>
</Window>
for the XAML, open the Solution Explorer
panel in the IDE, then click the little triangle
next to Main Window.xaml and double-click on
Main Window.xaml.cs. Now we see the code-behind file and can write some code to talk to
Kinect (Figure G). To tell the compiler where
to find the class definitions used in the code,
we declare:
using Microsoft.Research.Kinect.Nui;
Below the using statements, inside the
Main Window class definition but before its
constructor routine, add the following fields
to store the most recent depth image and a
color offset map that translates between pixel
positions in the IR camera’s depth image and
color camera pixel positions:
The GifImage tag references our own control
that supports animated GIFs like the ones
we’ll be pulling from the National Weather
Service. You can find code for the GifImage
class, along with all other code for this project,
and updates for future releases of Kinect SDK,
at
makeprojects.com/v/29. This article steps
through different versions of the code routines
as we add functionality, so be sure to paste in
the correct version for the step you’re at.
this.Loaded += (s, e) =>
{
InitKinect( Runtime.Kinects.;
;FirstOrDefault());
};
130 Make: makezine.com/29