Exemplo n.º 1
0
        /* Displaying current frame gestures */
        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;
                }

                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 += "Left Hand Gesture: " + gestureData.name;
                    }
                    else if (bodySideType == BodySideType.BODY_SIDE_RIGHT)
                    {
                        gestureStatusRight += "Right Hand Gesture: " + gestureData.name;
                    }
                }

                if (gestureStatusLeft == String.Empty)
                {
                    _form.UpdateInfo("Frame " + frameNumber + ") " + gestureStatusRight + "\n", System.Drawing.Color.SeaGreen);
                }
                else
                {
                    _form.UpdateInfo("Frame " + frameNumber + ") " + gestureStatusLeft + ", " + gestureStatusRight + "\n", System.Drawing.Color.SeaGreen);
                }
            }
        }
Exemplo n.º 2
0
        /* Displaying current frame gestures */
        private void DisplayGesture(PXCMHandData handAnalysis, int frameNumber)
        {
            int    firedGesturesNumber = handAnalysis.QueryFiredGesturesNumber();
            string gestureStatusLeft   = string.Empty;
            string gestureStatusRight  = string.Empty;

            if (firedGesturesNumber == 0)
            {
                return;
            }

            for (int i = 0; i < firedGesturesNumber; i++)
            {
                PXCMHandData.GestureData gestureData;
                if (handAnalysis.QueryFiredGestureData(i, out gestureData) == pxcmStatus.PXCM_STATUS_NO_ERROR)
                {
                    PXCMHandData.IHand handData;
                    if (handAnalysis.QueryHandDataById(gestureData.handId, out handData) != pxcmStatus.PXCM_STATUS_NO_ERROR)
                    {
                        return;
                    }

                    PXCMHandData.BodySideType bodySideType = handData.QueryBodySide();
                    if (bodySideType == PXCMHandData.BodySideType.BODY_SIDE_LEFT)
                    {
                        gestureStatusLeft += "Left Hand Gesture: " + gestureData.name;
                    }
                    else if (bodySideType == PXCMHandData.BodySideType.BODY_SIDE_RIGHT)
                    {
                        gestureStatusRight += "Right Hand Gesture: " + gestureData.name;
                    }
                }
            }
            if (gestureStatusLeft == String.Empty)
            {
                form.UpdateInfo("Frame " + frameNumber + ") " + gestureStatusRight + "\n", Color.SeaGreen);
            }
            else
            {
                form.UpdateInfo("Frame " + frameNumber + ") " + gestureStatusLeft + ", " + gestureStatusRight + "\n", Color.SeaGreen);
            }
        }