none
control mouse with hands - decide which is the active hand ? RRS feed

  • Question

  • I am doing skeleton tracking to control a mouse with the right hand. 

    I want to let the  left hand control the mouse too. How do I know which is the 'active' joint?  Do I  see which joint has the most movement ?

    Thanks,Peter

    Friday, March 30, 2012 5:25 PM

Answers

  • His code is very close to kinect mouse code and kinect mouse is doing what he wants it to do and it is supposed to do smoothing which is important to controlling mouse with kinect. Also, kinect mouse allows you to use the right hand to move mouse by default and to left click but if you check the checkbox for left handed you can move mouse with left hand but it also switchs the hands to click.

    Heres a chart of hand stances:

    Default: right hand moves mouse and left hand does a left click.

    Left-handed: left hand move mouse and right hand does a left click.


    Once you eliminate the impossible, whatever remains, no matter how improbable, must be the truth. - "Sherlock holmes" "speak softly and carry a big stick" - theodore roosevelt. Fear leads to anger, anger leads to hate, hate leads to suffering - Yoda




    • Marked as answer by peter clift Tuesday, April 10, 2012 3:36 PM
    • Edited by The Thinker Tuesday, April 10, 2012 6:25 PM
    Tuesday, April 10, 2012 12:10 PM

All replies

  • IMO no. Because you`re every joint is tracked in every second. Even if it isn`t moving it is tracked. Of course you can check where the diffrence beetwen each track is the biggest but imo it won`t work too good
    Sunday, April 1, 2012 7:35 PM
  • You could create a method to get you the active hand by sending to it the Active Skeleton

    Try this code and feedback me

    /// <summary>
    /// Gets the primary hand even is the left hand or the right hand.
    /// </summary>
    /// <param name="skeleton">The Active tracked skeleton.</param>
    /// <returns>Active Hand</returns>
    /// <Author>MOHAMED A. SAKR</Author>
    private Joint? GetActiveHand(Skeleton skeleton)
    {
       Joint leftHand =skeleton.Joints[JointType.HandRight];
       Joint rightHand =skeleton.Joints[JointType.HandRight];
    
       if (rightHand.TrackingState ==JointTrackingState.Tracked)
       {
                    if (leftHand.TrackingState != JointTrackingState.Tracked)
                        return rightHand;
                    else if (leftHand.Position.Z > rightHand.Position.Z)
                        return rightHand;
                    else
                        return leftHand;
       }
    
       if (leftHand.TrackingState ==JointTrackingState.Tracked)
              return leftHand;
       else return null;
    }


    Thanks,
    MOHAMED A. SAKR | Software Development Lead Engineer | EgyptNetwork
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. Also try to Vote as Helpful

    • Proposed as answer by MohamedSakr Tuesday, April 3, 2012 8:12 AM
    Tuesday, April 3, 2012 8:11 AM
  • Have you tryed this source code before asking?

    It does exactly what you want because im using some of the code in it for my project:

    http://kinectmouse.codeplex.com

    kinectmouse allows you to emulate the mouse but check the checkbox labeled left-handed to use your left hand to control mouse for left handed people. But you cannot use right and left joints together though to control a mouse because then how would you move the mouse I ask with coordinates from both hands? You have no good way of knowing tracked hand but if you can set to default hand in code if you want.


    Once you eliminate the impossible, whatever remains, no matter how improbable, must be the truth. - "Sherlock holmes" "speak softly and carry a big stick" - theodore roosevelt. Fear leads to anger, anger leads to hate, hate leads to suffering - Yoda



    • Proposed as answer by The Thinker Wednesday, April 4, 2012 4:37 PM
    • Edited by The Thinker Wednesday, April 4, 2012 4:40 PM
    Wednesday, April 4, 2012 4:37 PM
  • P.S. sample above does allow switching of hands using the kinect. look at the code that involves the checkbox control on the wpf form in the kinect mouse sample above but if a certain condition is met change the variable inside code to true.

    Once you eliminate the impossible, whatever remains, no matter how improbable, must be the truth. - "Sherlock holmes" "speak softly and carry a big stick" - theodore roosevelt. Fear leads to anger, anger leads to hate, hate leads to suffering - Yoda


    • Edited by The Thinker Tuesday, April 10, 2012 12:02 PM
    Tuesday, April 10, 2012 12:01 PM
  • Use code from MohamedSakr

    I totally forgot about this topic and couple days ago I worked on mouse tracking. You just need to analyze hand joints and take the closer one as the active. So compare the Z position of each hand. 

    That will do the trick :)

    Tuesday, April 10, 2012 12:09 PM
  • His code is very close to kinect mouse code and kinect mouse is doing what he wants it to do and it is supposed to do smoothing which is important to controlling mouse with kinect. Also, kinect mouse allows you to use the right hand to move mouse by default and to left click but if you check the checkbox for left handed you can move mouse with left hand but it also switchs the hands to click.

    Heres a chart of hand stances:

    Default: right hand moves mouse and left hand does a left click.

    Left-handed: left hand move mouse and right hand does a left click.


    Once you eliminate the impossible, whatever remains, no matter how improbable, must be the truth. - "Sherlock holmes" "speak softly and carry a big stick" - theodore roosevelt. Fear leads to anger, anger leads to hate, hate leads to suffering - Yoda




    • Marked as answer by peter clift Tuesday, April 10, 2012 3:36 PM
    • Edited by The Thinker Tuesday, April 10, 2012 6:25 PM
    Tuesday, April 10, 2012 12:10 PM