/// <summary>
 /// constructor of data from a gesture event
 /// </summary>
 /// <param name="e"></param>
 public Datas(GestureEventArgs e)
 {
     //BODY
     if (e.eventType == EventType.BODY)
     {
         this.GestureDatas = new GestureDatas(new BodyGestureEvent(e.eventData.bodyGestureEventData.bodyGestureName), null, e.eventData.contextGestureDatas);
     }
     //HANDS
     else if (e.eventType == EventType.HAND)
     {
         this.GestureDatas = new GestureDatas(null, new HandGestureDatas(e.eventData.handGestureEventData.handGestureName,
                                                                         e.eventData.handGestureEventData.handType), e.eventData.contextGestureDatas);
     }
 }
 /// <summary>
 /// constructor of data from a gesture event
 /// </summary>
 /// <param name="e"></param>
 public Datas(GestureEventArgs e)
 {
     //BODY
     if (e.eventType == EventType.BODY)
     {
         this.GestureDatas = new GestureDatas(new BodyGestureEvent(e.eventData.bodyGestureEventData.bodyGestureName), null, e.eventData.contextGestureDatas);
     }
     //HANDS
     else if (e.eventType == EventType.HAND)
     {
         this.GestureDatas = new GestureDatas(null, new HandGestureDatas(e.eventData.handGestureEventData.handGestureName,
             e.eventData.handGestureEventData.handType), e.eventData.contextGestureDatas);
     }
 }
 /// <summary>
 ///  launch the update on all gestures
 /// </summary>
 /// <param name="depthFrame">the depthImageFrame to observe</param>
 public void FindHandGestures(DepthImageFrame depthFrame)
 {
     if (skeleton != null)
     {
         handDetector.SetUp(skeleton, depthFrame);
         foreach (HandType handtype in Enum.GetValues(typeof(HandType)))
         {
             //Only LEFT and RIGHT
             if (handtype != HandType.NULL)
             {
                 result = handDetector.FindHandGesture(handtype);
                 if (!String.IsNullOrEmpty(result))
                 {
                     HandGestureName handGesture = (HandGestureName)Enum.Parse(typeof(HandGestureName), result.ToString());
                     if (this.GestureRecognised != null)
                     {
                         GestureDatas e = new GestureDatas();
                         e.handGestureEventData = new HandGestureDatas(handGesture, handtype);
                         this.GestureRecognised(this, new GestureEventArgs(EventType.HAND, e, Helper.GetTimeStamp()));
                     }
                 }
             }
         }
     }
 }
Beispiel #4
0
 public GestureEventArgs(EventType type, GestureDatas datas, DateTime time)
 {
     this.eventType = type;
     this.timeStamp = time;
     this.eventData = datas;
 }
 public GestureEventArgs(EventType type, GestureDatas datas, DateTime time)
 {
     this.eventType = type;
     this.timeStamp = time;
     this.eventData = datas;
 }
 /// <summary>
 /// constructor for GestureEvents:HAND
 /// </summary>
 /// <param name="name">name of the hand gesture</param>
 /// <param name="type">hand firing the event</param>
 public Datas(HandGestureName name, HandType type)
 {
     this.GestureDatas = new GestureDatas(null, new HandGestureDatas(name, type), null);
 }
 /// <summary>
 /// constructor for GestureEvents:BODY
 /// </summary>
 /// <param name="name">name of the body gesture</param>
 public Datas(BodyGestureName name)
 {
     this.GestureDatas = new GestureDatas(new BodyGestureEvent(name));
     this.unknownWord = "";
 }
Beispiel #8
0
        /// <summary>
        /// check the state of the gesture compared with the skeleton datas
        /// </summary>
        /// <param name="skel">the skeleton datas</param>
        /// <param name="gesture_context">the gesture context</param>
        public void updateGesture(Skeleton skel, ContextGesture gesture_context)
        {
            //are we in pause ?
            if (this.paused)
            {
                if (this.frameCount >= this.pausedFrameCount)
                {
                    this.paused = false;
                }
                this.frameCount++;
            }

            //get the result
            GesturePartResult result = this.segments[this.currentGesturePart].checkGesture(skel);

            if (result == GesturePartResult.SUCCESS)
            {
                if (this.currentGesturePart + 1 < this.segments.Length)
                {
                    //search for to next part
                    this.currentGesturePart++;
                    this.frameCount = 0;
                    this.pausedFrameCount = 25;
                    this.paused = true;
                }
                else
                {
                    //gesture had been recognised
                    if (this.GestureRecognised != null)
                    {
                        //use the method
                        GestureDatas e = new GestureDatas(new BodyGestureEvent(name), null, gesture_context);
                        this.GestureRecognised(this, new GestureEventArgs(EventType.BODY, e, Helper.GetTimeStamp()));
                        //reset
                        this.reset();
                    }
                }
            }
            else if (result == GesturePartResult.FAIL || this.frameCount >= 50)
            {
                this.currentGesturePart = 0;
                this.frameCount = 0;
                this.pausedFrameCount = 5;
                this.paused = true;
            }
            else
            {
                this.frameCount++;
                this.pausedFrameCount = 25;
                this.paused = true;
            }
        }
 /// <summary>
 /// constructor for GestureEvents:HAND
 /// </summary>
 /// <param name="name">name of the hand gesture</param>
 /// <param name="type">hand firing the event</param>
 public Datas(HandGestureName name, HandType type)
 {
     this.GestureDatas = new GestureDatas(null, new HandGestureDatas(name, type), null);
 }
 /// <summary>
 /// constructor for GestureEvents:BODY
 /// </summary>
 /// <param name="name">name of the body gesture</param>
 public Datas(BodyGestureName name)
 {
     this.GestureDatas = new GestureDatas(new BodyGestureEvent(name));
     this.unknownWord  = "";
 }