Back in November, some of you may have found out how to make a simple application which makes sounds and that can hover over buttons (Lesson 1). I got thinking that some of you may not want to hover over buttons and may want to make more use of gestures in your applications.
In this lesson I have shown you how you can add in some simple processes to your application which detect which position your hand is at. For example, if your hand is above your head, a nice message box will pop up. Now what you’re about to read below may sound a little technical but I will say that you should be able to follow it all from the video tutorial included. The only thing you will need for this lesson is:
- Visual Studio Express with C#
- Kinect SDK Beta 2
- This sample file
It is all about saying where the Joint is at that moment in time. For example:
I included this piece of code straight underneath the piece of the program which sets the position of my red circles:
ProcessGesture(data.Joints[JointID.Head], data.Joints[JointID.HandLeft], data.Joints[JointID.HandRight]);
This small piece of code passes each of the joints to a new process which is called gesture. The process uses these joints to find out where they are at that point in time. It is like standard English. if the position of the right hand is greater than the position of the head, then send out the message.
private void ProcessGesture(Joint head, Joint handleft, Joint handright)
if (handright.Position.Y > head.Position.Y)
MessageBox.Show(“Your Hand Is Above Your Head”);
OK, so I realise that this might sound really technical, however just give it a go. You can see in the video that it took roughly 10 minutes to make. Why not give 10 minutes of your time and try and get your program to do things based on your gesture.