2FAAST Kinect

Description

Today's project will interest those looking to emulate other Windows input functions via Kinect by showing how the Kinect can work with the Windows Input Simulator (C# SendInput Wrapper - Simulate Keyboard and Mouse) project.

2FAAST Kinect

Keyboard events simulator using angles calculated by using Microsoft Kinect SDK.

Basic Implementation of FAAST http://projects.ict.usc.edu/mxr/faast/ using kinect SDK.

Raise your right hand to the right to press right key , your left hand to the left to the left key. And hand up in the front to press up key.

Edit the code to change the keys or to use another angles to activate key press events.

Project Information URL: http://2faast.codeplex.com/ (and http://inputsimulator.codeplex.com/)

Project Download URL: http://2faast.codeplex.com/releases/view/74966

Project Source URL: http://2faast.codeplex.com/releases/view/74966

Runs with Beta2? Yes. Just remove/re-add the Microsoft.Research.Kinect reference.

1

2

3

void Nui_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
{

     canvas.Children.Clear();
     humanoid(e);
     args_e = e;
     foreach (SkeletonData user in e.SkeletonFrame.Skeletons)
     {

         if (user.TrackingState == SkeletonTrackingState.Tracked)
         {
             foreach (Joint joint in user.Joints)
             {
                 DrawPoint(joint, Colors.Red);
                 WriteNames(joint);
             }
           
         }
     }
}
  
private void WriteNames(Joint joint)
{
     var scaledJoint = ScaleJoint(joint);
     Label l = new Label();
     l.Margin = new Thickness(scaledJoint.Position.X, scaledJoint.Position.Y, 0, 0);
     l.Content = joint.ID.ToString();
     canvas.Children.Add(l);

}

private void DrawPoint(Joint joint, Color color)
{
     var scaledJoint = ScaleJoint(joint);
     Ellipse ellipse = new Ellipse
     {
         Fill = new SolidColorBrush(color),
         Width = 15,
         Height = 15,
         Opacity = 1,
         Margin = new Thickness(scaledJoint.Position.X, scaledJoint.Position.Y, 0, 0)
     };

     canvas.Children.Add(ellipse);
}

private void sendkeys(double left1,double left2,double right1,double right2)
{

    if (left1 >= 30)
    {
        InputSimulator.SimulateKeyDown(VirtualKeyCode.LEFT);
        left.Visibility = Visibility.Visible;
    }
    else
    {
        InputSimulator.SimulateKeyUp(VirtualKeyCode.LEFT);
    }
    if (left2 >= 30)
    {
        InputSimulator.SimulateKeyDown(VirtualKeyCode.UP);
        up.Visibility = Visibility.Visible;
    }
    else
    {
        InputSimulator.SimulateKeyUp(VirtualKeyCode.UP);
    }
    if (right1 >= 30)
    {
        InputSimulator.SimulateKeyDown(VirtualKeyCode.RIGHT);
        right.Visibility = Visibility.Visible;
    }
    else
    {
        InputSimulator.SimulateKeyUp(VirtualKeyCode.RIGHT);
    }
    if (right2 >= 30)
    {
        InputSimulator.SimulateKeyDown(VirtualKeyCode.UP);
        up.Visibility = Visibility.Visible;
    }
    else
    {
        InputSimulator.SimulateKeyUp(VirtualKeyCode.UP);
    }

}