Mousing around with the Kinect with Kinect Mouse Controller code sample
- Posted: Oct 08, 2012 at 6:00AM
- 6,435 views
- 3 comments
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
Today's project and source provides another example of using the Kinect as a mouse...
This sample will show you how to build a simple controller for the Kinect that will let you control the mouse on your Windows desktop using a Kinect device. This sample assumes that you have a Kinect for Windows device installed on your desktop and that you have the Kinect for Windows SDK Version 1.5 or greater. This sample also uses the WPF Kinect framework samples from Microsoft and I have included the necessary parts in the solution as a separate project.
This sample is very simple to understand if you already have a basic understanding of how the Kinect works. If you do not, you might want to look at my other sample on Beginning Kinect Programming. The main tasks we will be doing in this sample are:
1) Intercept the skeleton information from the Kinect and pick out the right hand.
2) Figure out the position of the right hand relative to the screen of the PC.
3) Pass that position to a Microsoft API for mouse control.
That's it really. As I said, it's a simple thing to do once you know how. We are also going to simulate a mouse click() function by setting a timer when the user is hovering over any spot on the screen for a certain length of time. We do that by creating a stopwatch and timing the hovers. So in the MainWindow constructor for the WPF XAML you will see a stopwatch being created, like this:
Project Information URL: http://code.msdn.microsoft.com/Easy-Kinect-Mouse-09233c52
Project Download URL: http://code.msdn.microsoft.com/Easy-Kinect-Mouse-09233c52
Project Source URL: http://code.msdn.microsoft.com/Easy-Kinect-Mouse-09233c52