Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Point-Cloud of Body Using Kinect SDK

I am making a program with the SDK, where when users are detected, The program draws a skeleton for them to follow. I recently saw a game advertised on my Xbox, Nike+ Kinect and saw how it displays a copy of the character doing something else like:

http://www.swaggerseek.com/wp-content/uploads/2012/06/fcb69__xboxkinect1.jpg

Or

http://www.swaggerseek.com/wp-content/uploads/2012/06/fcb69__xboxkinect.jpg

Can I create a point-cloud representation of the only the person detected (not any of the background)? Thanks in advance!


EDIT

Using this site, I can create point clouds, but still can't crop around the body of the person.

like image 918
Liam McInroy Avatar asked Jun 13 '12 22:06

Liam McInroy


2 Answers

You can do a very simple triangulation of the points. Check this tutorial:

http://www.riemers.net/eng/Tutorials/XNA/Csharp/Series1/Terrain_basics.php

Check the result:

enter image description here

like image 172
EdgarT Avatar answered Sep 23 '22 00:09

EdgarT


It doesn't look like they are displaying a complete point cloud but rather a blue shaded intensity map. This could be done with the depth image from the Kinect for Windows sdk. What you are looking for is the player index. This is a provided bit in each pixel of the depth image. In order to get the player index bit you have to also enable the skeletal stream in your initialization code.

So this is how I would do it. I am modifying one of the Kinect for Windows SDK quickstarts found here load it up and make the following changes:

//Change image type to BGRA32
image1.Source = 
                BitmapSource.Create(depthFrame.Width, depthFrame.Height, 
                96, 96, PixelFormats.Bgra32, null, pixels, stride); 

        //hardcoded locations to Blue, Green, Red, Alpha (BGRA) index positions       
        const int BlueIndex = 0;
        const int GreenIndex = 1;
        const int RedIndex = 2;
        const int AlphaIndex = 3;

//get player and depth at pixel
int player = rawDepthData[depthIndex] & DepthImageFrame.PlayerIndexBitmask;
int depth = rawDepthData[depthIndex] >> DepthImageFrame.PlayerIndexBitmaskWidth;

//check each pixel for player, if player is blue intensity.

            if (player > 0)
            {
                pixels[colorIndex + BlueIndex] = 255;
                pixels[colorIndex + GreenIndex] = intensity;
                pixels[colorIndex + RedIndex] = intensity;
                pixels[colorIndex + AlphaIndex] = 100;

            }
            else
            {
                //if not player make black and transparent
                pixels[colorIndex + BlueIndex] = 000;
                pixels[colorIndex + GreenIndex] = 000;
                pixels[colorIndex + RedIndex] = 000;
                pixels[colorIndex + AlphaIndex] = 0;
            }

I like using this example for testing the colors since it still provides you with the depth viewer on the right side. I have attached an image of this effect running below:

enter image description here

The image to the left is the intensity map with slightly colored pixel level intensity data.

Hope that helps David Bates

like image 23
davidbates Avatar answered Sep 20 '22 00:09

davidbates