KinectManager.IsJointTracked C# (CSharp) Method

IsJointTracked() public method

public IsJointTracked ( uint UserId, int joint ) : bool
UserId uint
joint int
return bool
    public bool IsJointTracked(uint UserId, int joint)
    {
        KinectWrapper.GetJointTransformation(UserId, joint, ref jointTransform);
        return jointTransform.ori.confidence > 0.5;
    }

Usage Example

    private bool GetUserBodyHeight(KinectManager manager, float scaleFactor, ref float height)
    {
        height = 0f;

        if (manager && manager.IsJointTracked(currentUserId, (int)KinectInterop.JointType.HipLeft) &&
            manager.IsJointTracked(currentUserId, (int)KinectInterop.JointType.HipRight) &&
            manager.IsJointTracked(currentUserId, (int)KinectInterop.JointType.ShoulderLeft) &&
            manager.IsJointTracked(currentUserId, (int)KinectInterop.JointType.ShoulderRight))
        {
            //Vector3 posHipCenter = manager.GetJointPosition(currentUserId, (int)KinectInterop.JointType.SpineBase);
            Vector3 posHipLeft   = manager.GetJointPosition(currentUserId, (int)KinectInterop.JointType.HipLeft);
            Vector3 posHipRight  = manager.GetJointPosition(currentUserId, (int)KinectInterop.JointType.HipRight);
            Vector3 posHipCenter = (posHipLeft + posHipRight) / 2;

            Vector3 posShoulderLeft   = manager.GetJointPosition(currentUserId, (int)KinectInterop.JointType.ShoulderLeft);
            Vector3 posShoulderRight  = manager.GetJointPosition(currentUserId, (int)KinectInterop.JointType.ShoulderRight);
            Vector3 posShoulderCenter = (posShoulderLeft + posShoulderRight) / 2;

            height = (posShoulderCenter.y - posHipCenter.y) * scaleFactor;

            return(true);
        }

        return(false);
    }
All Usage Examples Of KinectManager::IsJointTracked