public void OnFiredGesture(Object sender, HandConfiguration.GestureEventArgs args)
        {
            GestureData data = args.data;
            string      gestureStatusLeft  = string.Empty;
            string      gestureStatusRight = string.Empty;

            IHand hand;

            if (handData.QueryHandDataById(data.handId, out hand) != Status.STATUS_NO_ERROR)
            {
                return;
            }
            BodySideType bodySideType = hand.BodySide;

            if (bodySideType == BodySideType.BODY_SIDE_LEFT)
            {
                gestureStatusLeft += "Left Hand Gesture: " + data.name;
            }
            else if (bodySideType == BodySideType.BODY_SIDE_RIGHT)
            {
                gestureStatusRight += "Right Hand Gesture: " + data.name;
            }

            if (gestureStatusLeft == String.Empty)
            {
                form.UpdateGestureInfo("Frame " + data.frameNumber + ") " + gestureStatusRight + "\n", System.Drawing.Color.SeaGreen);
            }
            else
            {
                form.UpdateGestureInfo("Frame " + data.frameNumber + ") " + gestureStatusLeft + ", " + gestureStatusRight + "\n", System.Drawing.Color.SeaGreen);
            }
        }
Пример #2
0
        /*显示当前帧手势*/
        private void DisplayGesture(HandData handAnalysis, int frameNumber)
        {
            if (handAnalysis.FiredGestureData != null)
            {
                int    firedGesturesNumber = handAnalysis.FiredGestureData.Length;
                string gestureStatusLeft   = string.Empty;
                string gestureStatusRight  = string.Empty;

                if (firedGesturesNumber == 0)
                {
                    return;
                }
                GestureData data;
                string      test = "---";
                if (handAnalysis.IsGestureFired("v_sign", out data))
                {
                    test = test + "v_sign";
                }


                foreach (var gestureData in handAnalysis.FiredGestureData)
                {
                    IHand handData;
                    if (handAnalysis.QueryHandDataById(gestureData.handId, out handData) != Status.STATUS_NO_ERROR)
                    {
                        return;
                    }

                    BodySideType bodySideType = handData.BodySide;
                    if (bodySideType == BodySideType.BODY_SIDE_LEFT)
                    {
                        gestureStatusLeft += "左手手势: " + gestureData.name;
                    }
                    else if (bodySideType == BodySideType.BODY_SIDE_RIGHT)
                    {
                        gestureStatusRight += "右手手势: " + gestureData.name;
                    }
                }

                if (gestureStatusLeft == String.Empty)
                {
                    _form.UpdateInfo("Frame " + frameNumber + ") " + gestureStatusRight + ", " + test + "\n", System.Drawing.Color.SeaGreen);
                }
                else
                {
                    _form.UpdateInfo("Frame " + frameNumber + ") " + gestureStatusLeft + ", " + gestureStatusRight + ", " + test + "\n", System.Drawing.Color.SeaGreen);
                }
            }
        }