This project is read-only.

Swipe gesture recognized multiple times?

Apr 11, 2014 at 1:28 PM
Hello,

I'm working on a projekt for university, and I'm new to programming with kinect. I'm trying to detect SwipeLeft or SwipeRight-Movement with kinect toolbox 1.7, so that I can do a certain action when the gesture is recognized. Although this works, the event is fired dozens of times (maybe because a swipe gesture could be divided in to multiple swipes?). I just want it to be fired once, so that the corresponding action takes place only once too. Of course after a short duration, new gestures should be recognized. I tried the MinimalPeriodBetweenGestures attribute, and although debugging says I set it correctly, it does not have any effect on my problem. Here is what i have so far:
        ..
        private SwipeGestureDetector swipeGestureDectector;
        ..

        private void WindowLoaded(object sender, RoutedEventArgs e)
        {
            this.swipeGestureDectector = new SwipeGestureDetector();
            swipeGestureDectector.MinimalPeriodBetweenGestures = 1000;
            ..
            if (null != this.sensor)
            {
               ..
                // Add an event handler to be called whenever there is new color frame data
                this.sensor.SkeletonFrameReady += this.SensorSkeletonFrameReady;
                this.swipeGestureDectector.OnGestureDetected += on_GestureDetected;            
            }
            ..
        }
        ..
        private void SensorSkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
        {
           ..
           if (skel.TrackingState == SkeletonTrackingState.Tracked)
           {
              swipeGestureDectector.Add(skel.Joints[JointType.HandRight].Position,   sensor);
           }
           ,,       
        }
        ..
        public void on_GestureDetected(string gest)
        {
            if (gest == "SwipeToRight")
            {
                MessageBox.Show("Swipe To Right");
            }

            if (gest == "SwipeToLeft")
            {
                MessageBox.Show("Swipe To Left");
            }
        }
Don't know what example I used, but the textbox appears a dozen times, though only one gesture was made. Am I missing something.

Thanks in Advance

Michael