Exemplo n.º 1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="refUser">User data</param>
 public MinimizeCondition(UserData refUser)
     : base(refUser)
 {
     m_nIndex = 0;
     m_refChecker = new Checker(refUser, PropertiesPluginKinect.Instance.MinimizeCherckerTolerance);
     m_GestureBegin = false;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="refUser">User Data</param>
 public PostureHomeCondition(UserData refUser)
     : base(refUser)
 {
     m_nIndex = 0;
     m_frameInitCounter = 0;
     m_refChecker = new Checker(refUser, PropertiesPluginKinect.Instance.PostureCheckerTolerance);
     m_GestureBegin = false;
 }
Exemplo n.º 3
0
        public PostureAChecker(UserData refUser)
            : base(new List<Condition> {

                new PostureACondition(refUser)

            }, ConditionTimeout)
        {
        }
Exemplo n.º 4
0
        public MaximizeGestureChecker(UserData refUser)
            : base(new List<Condition> {

                new MaximizeCondition(refUser)

            }, ConditionTimeout)
        {
        }
Exemplo n.º 5
0
        public PushGestureChecker(UserData refUser, JointType refHand)
            : base(new List<Condition> {

                new PushCondition(refUser, refHand)

            }, ConditionTimeout)
        {
        }
Exemplo n.º 6
0
 public WaveGestureChecker(UserData refUser, JointType hand)
     : base(new List<Condition>
     {
         new WaveLeftCondition(refUser, hand),
         new WaveRightCondition(refUser, hand)                
     }, ConditionTimeout)
 {
 }
Exemplo n.º 7
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="refUser">User data</param>
 /// <param name="leftOrRightHand">Hand treated</param>
 public SwipeCondition(UserData refUser, JointType leftOrRightHand)
     : base(refUser)
 {
     m_nIndex = 0;
     m_refHand = leftOrRightHand;
     m_refChecker = new Checker(refUser, PropertiesPluginKinect.Instance.SwipeCheckerTolerance);
     m_handVelocity = new List<double>();
     m_GestureBegin = false;
 }
Exemplo n.º 8
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="refUser">User data</param>
 /// <param name="hand"> hand treated</param>
 public WaveLeftCondition(UserData refUser, JointType hand)
     : base(refUser)
 {
     m_nIndex = 0;
     m_nTryCondition = 0;
     m_refChecker = new Checker(refUser, PropertiesPluginKinect.Instance.WaveCheckerTolerance);
     m_refHand = hand;
     m_GestureBegin = false;
 }
Exemplo n.º 9
0
        /// <summary>
        /// Create a UserData to replay
        /// The joints position represent the first frame for the replay.
        /// </summary>
        /// <param name="userID">User ID</param>
        /// <param name="jointPosition">Joints position</param>
        /// <param name="depth">Depth</param>
        /// <param name="timesTamp">TimesTamp</param>
        public void CreateUser(int userID, Dictionary<string, Point3D> jointPosition, double depth, long timesTamp)
        {
            // Create Skeleton
            Skeleton newSkeleton = CreateSkeleton(jointPosition);

            // Create UserData
            m_refUserData = new UserData(userID, newSkeleton, depth, timesTamp);

            // Conect event
            m_refUserData.UserGestureDetected += OnUserGestureDetected;
        }
Exemplo n.º 10
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="refUser">User data</param>
 /// <param name="hand">Hand treated</param>
 public WaveRightCondition(UserData refUser, JointType hand)
     : base(refUser)
 {
     m_nIndex = 0;
     m_refChecker = new Checker(refUser, PropertiesPluginKinect.Instance.WaveCheckerTolerance);
     m_nTryCondition = 0;
     m_handVelocity = new List<double>();
     m_refDirection = EnumKinectDirectionGesture.KINECT_DIRECTION_NONE;
     m_refHand = hand;
     m_GestureBegin = false;
 }
Exemplo n.º 11
0
 /// <summary>
 /// Create a gesture part, whose fullfillment is checked on User refUser.</summary>
 /// <param name="refUser">
 /// User who has to fullfill this condition</param>
 public Condition(UserData refUser)
 {
     m_User = refUser;
 }
Exemplo n.º 12
0
 /// <summary>
 /// Constructor</summary>
 /// <param name="user">User to verify</param>
 public Checker(UserData user, double tolerance)
 {
     m_User = user;
     m_Tolerance = tolerance;
 }
Exemplo n.º 13
0
        public GestureRecognizerManager(UserData user)
        {
            //m_InstanceGestureRecognizerManager = this;

            m_refUser = user;

            #region Variables initialisation

            // Instantiate timer for manage gesture recognize
            m_refTimerGestureManager = new Timer();
            m_refTimerGestureManager.Interval = PropertiesPluginKinect.Instance.GestureRecognizedTime;
            m_refTimerGestureManager.Elapsed += OnTimeOutGesture;

            // Initialize buffer gesture recognition
            m_refGestureRecognized = new List<EnumGesture>();

            // Initialize gesture begin flags
            var ValueGestureAsList = System.Enum.GetValues(typeof(EnumGesture));
            m_refFlagGesturesBegin = new Dictionary<EnumGesture, bool>();
            foreach (EnumGesture gesture in ValueGestureAsList)
            {
                m_refFlagGesturesBegin.Add(gesture, false);
            }

            m_refAuthorizedGesture = true;

            // Instantiate timer for manage when a posture is recognized
            m_refTimerPostureManager = new Timer();
            m_refTimerPostureManager.Interval = PropertiesPluginKinect.Instance.PostureRecognizedTime;
            m_refTimerPostureManager.Elapsed += OnTimeOutPosture;

            m_refPostureRecognized = PropertiesPluginKinect.Instance.SavePosturerecognize;

            if (PropertiesPluginKinect.Instance.SavePosturerecognize != EnumPosture.POSTURE_NONE)
            {
                m_refTimerPostureManager.Start();
            }

            // Initialize posture begin flags
            var ValuePostureAsList = System.Enum.GetValues(typeof(EnumPosture));
            m_refFlagPostureBegin = new Dictionary<EnumPosture, bool>();
            foreach (EnumPosture posture in ValuePostureAsList)
            {
                m_refFlagPostureBegin.Add(posture, false);
            }

            // Listen the Gestures enable changement
            PropertiesPluginKinect.Instance.SynchronizeGesturesState += OnSynchronizeGesturesState;

            #endregion

            #region Gesture Checker initialisation

            if(!PropertiesPluginKinect.Instance.KinectPointingModeEnabled)
            {
                if (PropertiesPluginKinect.Instance.EnableGestureSwipeRight || PropertiesPluginKinect.Instance.EnableGestureSwipeLeft)
                {
                    m_refSwipeHandRightChecker = new SwipeGestureChecker(user, JointType.HandRight);
                    EnableGestureChecker(m_refSwipeHandRightChecker);

                    m_refSwipeHandLeftChecker = new SwipeGestureChecker(user, JointType.HandLeft);
                    EnableGestureChecker(m_refSwipeHandLeftChecker);
                }

                if (PropertiesPluginKinect.Instance.EnableGestureWave)
                {
                    m_refHandRightWaveChecker = new WaveGestureChecker(user, JointType.HandRight);
                    EnableGestureChecker(m_refHandRightWaveChecker);

                    m_refHandLeftWaveChecker = new WaveGestureChecker(user, JointType.HandLeft);
                    EnableGestureChecker(m_refHandLeftWaveChecker);
                }

                if (PropertiesPluginKinect.Instance.EnableGesturePush)
                {
                    m_refPushRightHandGestureChecker = new PushGestureChecker(user, JointType.HandRight);
                    EnableGestureChecker(m_refPushRightHandGestureChecker);

                    m_refPushLeftHandGestureChecker = new PushGestureChecker(user, JointType.HandLeft);
                    EnableGestureChecker(m_refPushLeftHandGestureChecker);
                }

                if (PropertiesPluginKinect.Instance.EnableGestureMaximize)
                {
                    m_refMaximizeGestureChecker = new MaximizeGestureChecker(user);
                    EnableGestureChecker(m_refMaximizeGestureChecker);
                }

                if (PropertiesPluginKinect.Instance.EnableGestureMinimize)
                {
                    m_refMinimizeGestureChecker = new MinimizeGestureChecker(user);
                    EnableGestureChecker(m_refMinimizeGestureChecker);
                }
            }

            if (PropertiesPluginKinect.Instance.EnablePostureA)
            {
                m_refPostureAChecker = new PostureAChecker(user);
                EnablePostureChecker(m_refPostureAChecker);
            }

            if (PropertiesPluginKinect.Instance.EnablePostureHome)
            {
                m_refPostureHomeChecker = new PostureHomeChecker(user);
                EnablePostureChecker(m_refPostureHomeChecker);
            }

            if (PropertiesPluginKinect.Instance.EnablePostureStay)
            {
                m_refPostureStayChecker = new PostureStayChecker(user);
                EnablePostureChecker(m_refPostureStayChecker);
            }

            if (PropertiesPluginKinect.Instance.EnablePostureT)
            {
                m_refPostureTChecker = new PostureTChecker(user);
                EnablePostureChecker(m_refPostureTChecker);
            }

            if (PropertiesPluginKinect.Instance.EnablePostureU)
            {
                m_refPostureUChecker = new PostureUChecker(user);
                EnablePostureChecker(m_refPostureUChecker);
            }

            if (PropertiesPluginKinect.Instance.EnablePostureV)
            {
                m_refPostureVChecker = new PostureVChecker(user);
                EnablePostureChecker(m_refPostureVChecker);
            }

            if (PropertiesPluginKinect.Instance.EnablePostureWait)
            {
                m_refPostureWaitChecker = new PostureWaitChecker(user);
                EnablePostureChecker(m_refPostureWaitChecker);
            }
            #endregion
        }
Exemplo n.º 14
0
 /// <summary>
 /// Terminates the replay
 /// </summary>
 public void EndReplay()
 {
     m_refUserData = null;
 }
Exemplo n.º 15
0
 /// <summary>
 /// Constructor
 /// </summary>
 public DataUserReplay()
 {
     m_refUserData = null;
 }
Exemplo n.º 16
0
        /// <summary>
        /// Record a new data frame in file
        /// </summary>
        /// <param name="refUserData">User data of new frame</param>
        public void RecordData(UserData refUserData)
        {
            if (m_refStream != null)
            {
                // Create a new data line
                string line = null;

                // Frame number
                line += m_dNumFrame.ToString() + ";";

                // User ID
                line += refUserData.UserID + ";";

                // Joints position in real world
                foreach (Microsoft.Kinect.JointType joint in m_refJointType)
                {
                    line += refUserData.UserSkeleton.GetJointPosition(joint).X.ToString() + " ";
                    line += refUserData.UserSkeleton.GetJointPosition(joint).Y.ToString() + " ";
                    line += refUserData.UserSkeleton.GetJointPosition(joint).Z.ToString() + ";";
                }

                // Joints position on screen
                foreach (Microsoft.Kinect.JointType joint in m_refJointType)
                {
                    line += refUserData.UserSkeleton.GetJointPositionOnScreen(joint).X.ToString() + " ";
                    line += refUserData.UserSkeleton.GetJointPositionOnScreen(joint).Y.ToString() + ";";
                }

                // User depth
                line += refUserData.UserDepth.ToString() + ";";

                // User nearest or not
                line += refUserData.IsNearest.ToString() + ";";

                // Frame Timestamp
                line += refUserData.UserSkeleton.TimesTamp.ToString();

                // Write line in file
                m_refStream.WriteLine("{0}", line);

                m_dNumFrame++;
            }
        }