Aligning the Kinect skeleton with video or depth images
- Posted: Feb 03, 2012 at 6:00 AM
- 6,614 Views
- 1 Comment
Loading User Information from Channel 9
Something went wrong getting user information from Channel 9
Loading User Information from MSDN
Something went wrong getting user information from MSDN
Loading Visual Studio Achievements
Something went wrong getting the Visual Studio Achievements
The final post in out "Skeleton week" provides a final piece of the skeleton puzzle...
The most asked for snippet of code at our recent workshop that I didn’t have was how to properly align a Kinect skeleton to either the Video image or the depth image. It turns out this is non trivial and most samples that just scale all three items to fit the screen are wrong. I took the time this weekend to make a good sample for others to follow. If you just want the two snippets scroll to the very bottom of the article otherwise continue reading for a full walkthrough, it starts with Kinect Beta2 clean WPF code.
To make this super easy for you to drop into your project I’m going to put this scaling into my skeleton control and let you choose by setting a mode. In order to scale to the depth image or the video image you need to do up to 3 things:
- Set the ScaleMode property to ToFill, ToDepth, ToVideo
- Set reference to the Kinect Runtime being used, set property Runtime.
- (Video only) We need the Depth PlanerImage, pass into method DepthImage.
...
Comments
As you can see it is not as simple or as clean as you like, a simple extension method to the Joint would be ideal, instead we need access to the Runtime itself to get the depth pixel and a depth image frame to get the colour pixel. Lastly during testing I found that 640x480 video with 320x240 depth worked fine, but up the depth to 640x480 and the whole thing was off, hence the fix, weird. You may have noticed this all works with/without the playerindex being captured in the depth stream but even with that off it fails for colour image about 640x480. I don’t see why this shouldn’t work with 1280x1024 image but it doesn’t. Let’s hope this all gets addressed for the next beta but until then feel free to use the code from this article in any form.
Project Information URL: http://www.soulsolutions.com.au/Blog/tabid/73/EntryId/770/Aligning-a-Kinect-Skeleton-with-the-Video-or-Depth-images.aspx
Project Source URL: http://www.soulsolutions.com.au/examples/videoskeleton.zip
Contact Information:
Page image, Lego Skeleton,courtesy of onathanb1989
Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation,
please create a new thread in our Forums,
or
Contact Us and let us know.
Follow the Discussion
Oops, something didn't work.
What does this mean?
Following an item on Channel 9 allows you to watch for new content and comments that you are interested in. You need to be signed in to Channel 9 to use this feature.What does this mean?
Following an item on Channel 9 allows you to watch for new content and comments that you are interested in and view them all on your notifications page.sign up for email notifications?
HYe, what is the source code if we want to know what is the coordinate of the joint
Remove this comment
Remove this thread
close