Entries:
Comments:
Posts:

Loading User Information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading User Information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

2FAAST Kinect

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);
    }

}

Follow the Discussion

  • I love the use of the classic theme on Windows for a Kinect post. I guess it could just be a graphics/Windows version limitation on the system but still a nice blend of the old and the new Smiley

  • RajatRajat

    :) , the reason for using the classic theme is that i have a netbook and its too slow if the use the windows 7 aero theme .

  • rajatrajat

    if i* use the windows 7 aero theme

Remove this comment

Remove this thread

close

Comments Closed

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.