SKILL BUILDER KINECT HACKING
intermediate developer could use to speed
up the code and to sync the RGB and depth
frames better, based on timestamp.
3. Track the skeleton and add the maps.
Finally, we want to add the weather maps in
the background and be able to switch them
using a simple gesture. To recognize the gesture, we’ll use Kinect’s skeleton tracking data.
What kind of gesture? Broadcast meteorologists often change the weather map as
they walk across the screen and pivot to face
the opposite direction. To detect this gesture,
we need to check 2 conditions: which side
of the image the ShoulderCenter joint is on,
and whether the left shoulder or right shoulder is closer to the camera. If both of these
conditions change from their previous state,
we know the user has performed the walk-and-turn gesture and we can cycle the background image. We check for turning so that
the background doesn’t cycle when the user
is just reaching for the far side of the map.
To add this feature, we first need to add a
few fields at the top of the Main Window class:
To retrieve the map images, add the following inside the Main Window constructor after the
call to InitializeComponent(). You can substitute the URLs for other animated GIF maps
provided by the National Weather Service:
Now update the runtime_SkeletonFrameReady
method to the code version under “Track the
also add the new CycleBackground() method,
which cycles through the background images
with each body-turn gesture. The code will
find the skeleton closest to the Kinect and
use shoulder positions to determine if the
skeleton is facing right or left, and if the pose
changes it will call CycleBackground to put up
a new animated background image, which is
downloaded automatically (Figure J).
Now stand up, and with your best voice,
describe and gesticulate over the weather
map background. To change images, walk to
the other side of the image while turning your
shoulders toward the center.
Congratulations, you’ve just made a Kinect
hack! Now go show it off to your friends and
see what else you can come up with.
int currentBackground = - 1;
List<string> bgImages = new List<string>();
bool isPoseLeft = false;
bool isPoseRight = false;
For project code, video of the Kinect
Weather Map hack in action, and other
132 Make: makezine.com/29