in these days of festivities, when you join the side 2 dwarves wanting to play, you got the kinect connected to the PC and the SDK that you strange, at the very least you get is something like the following:
An application for every person that appears on WebCam puts a Santa Claus Cap!!!!
Disclaimer: as they can be seen in the screenshot, in addition to the view of the WebCam I am showing the skeleton, but just as he gave a ray of sunshine to my dwarf in the arm, therefore not recognized him!
As well, after several post about Kinect, today the challenge was as follows
- identify the specific joint of the head of each skeleton
- calculate the relative coordinates of that joint before an image of the webcam
- paint a Santa Hat on webcam
The first point is easily solved once we iteramos by the skeletons recognized in mode Trackeable (lines 6 to 9), we can iterate between the Joints of the skeleton and verify that it is the head compared with [JointID.Head] (line 17).
Once identified the head Joint we come to the 2nd point which is a bit more complicated. Function GetDisplayPosition() (line 27) is in charge for the conversion of the position of the Joint to relative location in the image. The following capabilities of the SDK are used to this
- SkeletonEngine.SkeletonToDepthImage () using this function we can know the relative location in “depth” of a joint.
- NuiCamera.GetColorPixelCoordinatesFromDepthPixel () using this function, we can discover the position at coordinates x/Y from the depth we obtained earlier.
In both cases, it must make some adjustments on the one hand the webcam image is 640 * 480 resolution and depth capacity is only 320 * 240. But hey, with these few lines already we can define the specific location of our head and paint a SantaHat therein.
This time I changed the mode of publication and if you want to download the code can do since CodePlex fromhttp://kinectmerrychristmas.codeplex.com/ .
If you already have a Kinect, SDK and wanted to test the application, you can install it directly fromhttp://kinectmerrychristmas.codeplex.com/releases/79524/clickOnce/ElBruno.MerryChristmas.application
Greetings @ Home and Merry Christmas
- Kinect References
- CodePlext Project
- CodePlex ClickOnce Publising