示例#1
0
        private bool isIntermediaryFrameValidGestureFrame(GESTURE gesture, GestureDatabase gestureDatabase)
        {
            Skeleton currentSkeleton;
            AppropriateJointInfo currentAptJointInfo;

            gestureDatabase.getLastRecord(out currentSkeleton, out currentAptJointInfo);

            switch (gesture)
            {
                case GESTURE.SWIPE_RIGHT:
                    {
                        HCI580_Geometry.Vector2D currentElbowShoulder = new HCI580_Geometry.Vector2D((currentAptJointInfo.shoulderRightPos.X - currentAptJointInfo.elbowRightPos.X),
                                                                                              (currentAptJointInfo.shoulderRightPos.Y - currentAptJointInfo.elbowRightPos.Y));

                        HCI580_Geometry.Vector2D currentElbowHand = new HCI580_Geometry.Vector2D((currentAptJointInfo.handRightPos.X - currentAptJointInfo.elbowRightPos.X),
                                                                                          (currentAptJointInfo.handRightPos.Y - currentAptJointInfo.elbowRightPos.Y));

                        // check if hand Y > elbow Y , angle between elbowShoulder and elbowHand negative
                        if (currentAptJointInfo.handRightPos.Y > currentAptJointInfo.elbowRightPos.Y &&
                            currentElbowShoulder.cpsign(currentElbowHand) < 0)
                        {

                            return true;

                        }
                    }
                    break;
                case GESTURE.SWIPE_LEFT:
                    {
                        HCI580_Geometry.Vector2D currentElbowShoulder = new HCI580_Geometry.Vector2D((currentAptJointInfo.shoulderRightPos.X - currentAptJointInfo.elbowRightPos.X),
                                                                                              (currentAptJointInfo.shoulderRightPos.Y - currentAptJointInfo.elbowRightPos.Y));

                        HCI580_Geometry.Vector2D currentElbowHand = new HCI580_Geometry.Vector2D((currentAptJointInfo.handRightPos.X - currentAptJointInfo.elbowRightPos.X),
                                                                                          (currentAptJointInfo.handRightPos.Y - currentAptJointInfo.elbowRightPos.Y));

                        // check if hand Y > elbow Y , angle between elbowShoulder and elbowHand negative
                        if (currentAptJointInfo.handRightPos.Y > currentAptJointInfo.elbowRightPos.Y &&
                            currentElbowShoulder.cpsign(currentElbowHand) < 0)
                        {
                            return true;
                        }
                    }
                    break;

            }
            return false;
        }
示例#2
0
        private bool isFirstValidGestureFrame(GESTURE gesture , GestureDatabase gestureDatabase)
        {
            Skeleton skeleton;
            AppropriateJointInfo aptJointInfo;

            gestureDatabase.getLastRecord(out skeleton ,out aptJointInfo);

            switch(gesture)
            {
                case GESTURE.SWIPE_RIGHT:
                    {
                        HCI580_Geometry.Vector2D elbowShoulder = new HCI580_Geometry.Vector2D((aptJointInfo.shoulderRightPos.X - aptJointInfo.elbowRightPos.X),
                                                                                              (aptJointInfo.shoulderRightPos.Y - aptJointInfo.elbowRightPos.Y));

                        HCI580_Geometry.Vector2D elbowHand = new HCI580_Geometry.Vector2D((aptJointInfo.handRightPos.X - aptJointInfo.elbowRightPos.X),
                                                                                          (aptJointInfo.handRightPos.Y - aptJointInfo.elbowRightPos.Y));

                        // check if hand Y > elbow Y , hand X < elbow X and angle between elbowShoulder and elbowHand negative
                        if(aptJointInfo.handRightPos.Y > aptJointInfo.elbowRightPos.Y &&
                           aptJointInfo.handRightPos.X < aptJointInfo.elbowRightPos.X &&
                           elbowShoulder.cpsign(elbowHand) < 0)
                        {
                            return true;
                        }
                    }
                    break;

                case GESTURE.SWIPE_LEFT:
                    {
                        HCI580_Geometry.Vector2D elbowShoulder = new HCI580_Geometry.Vector2D((aptJointInfo.shoulderRightPos.X - aptJointInfo.elbowRightPos.X),
                                                                                              (aptJointInfo.shoulderRightPos.Y - aptJointInfo.elbowRightPos.Y));

                        HCI580_Geometry.Vector2D elbowHand = new HCI580_Geometry.Vector2D((aptJointInfo.handRightPos.X - aptJointInfo.elbowRightPos.X),
                                                                                          (aptJointInfo.handRightPos.Y - aptJointInfo.elbowRightPos.Y));

                        // check if hand Y > elbow Y , hand X < elbow X and angle between elbowShoulder and elbowHand negative
                        if(aptJointInfo.handRightPos.Y > aptJointInfo.elbowRightPos.Y &&
                           aptJointInfo.handRightPos.X > aptJointInfo.elbowRightPos.X &&
                           elbowShoulder.cpsign(elbowHand) < 0)
                        {
                            return true;
                        }
                    }
                    break;

            }
            return false;
        }