Пример #1
0
 public GestureFeedback(Gesture gesture)
 {
     InitializeComponent();
     this.Gesture = gesture;
     this.CurrentStepTextBlock.Text = gesture.Steps[0].Pose.Name;
     this.MainGestureAndPoseNameTextBlock.Text = gesture.Name;
     this.Stopwatch = new Stopwatch();
     this.Stopwatch.Start();
 }
Пример #2
0
        public static bool IsInternallyValid(Gesture gesture, out List<PoseSafetyException> exceptions)
        {
            bool result = true;
            exceptions = new List<PoseSafetyException>();
            foreach (var step in gesture.Steps)
            {
                var pose = step.Pose;
                Z3Body witness = null;
                if (!Validity.IsInternallyValid(pose))
                {
                    var exception = new PoseSafetyException(
                        "Pose failed internal validity check!", pose, witness
                        );
                    exceptions.Add(exception);
                    result = false;
                }
            }

            return result;
        }
Пример #3
0
        private void Initialize()
        {
            sensor = KinectSensor.GetDefault();
            bfr = sensor.BodyFrameSource.OpenReader();
            bfr.FrameArrived += bfr_FrameArrived;
            pgd = new PreposeGesturesDatabase("soccer.app");
            pgfs = new PreposeGesturesFrameSource(KinectSensor.GetDefault(), 0);

            foreach (var g in pgd.AvailableGestures)
            {
                if (g.Name.Equals("ola"))
                {
                    gesture = g;
                    pgfs.AddGesture(gesture);
                }
            }
            pgr = pgfs.OpenReader();
            pgfs.GetIsEnabled(gesture);
            pgr.FrameArrived += pgr_FrameArrived;
            sensor.Open();
        }
Пример #4
0
 public void AddGesture(Gesture gesture)
 {
     var matcher = new GestureMatcher(gesture);
     Matchers.Add(matcher);
 }
Пример #5
0
 internal GestureMatcher(Gesture gesture)
 {
     this.Gesture = gesture;
     this.LastDistance = 0;
     this.CompletedCount = 0;
     this.Target = null;
 }
Пример #6
0
 public PairwiseConflictException(string message, Gesture gesture1, Gesture gesture2, Z3Body body)
     : base(message)
 {
     this.Witness = body;
     this.Gesture1 = gesture1;
     this.Gesture2 = gesture2;
 }
Пример #7
0
        /// <summary>
        /// Checks if the pose is within default safety 
        /// restrictions when the transform and restrictions 
        /// are applied.
        /// </summary>
        /// <returns>True if it's safe</returns>
        public static bool IsWithinDefaultSafetyRestrictions(Gesture gesture, out List<PoseSafetyException> exceptions)
        {
            bool result = true;
            exceptions = new List<PoseSafetyException>();
            foreach (var step in gesture.Steps)
            {
                var pose = step.Pose;
                Z3Body witness = null;
                if (!Safety.IsWithinSafetyRestrictions(pose, out witness))
                {
                    var exception = new PoseSafetyException(
                        "Default safety violation", pose, witness
                        );
                    exceptions.Add(exception);
                    result = false;
                }
            }

            return result;
        }
Пример #8
0
 public void SetIsEnabled(Gesture gesture, bool isEnabled)
 {
 }
Пример #9
0
 public void RemoveGesture(Gesture gesture)
 {
     Gestures.Remove(gesture);
 }
Пример #10
0
 public bool GetIsEnabled(Gesture gesture)
 {
     // Gestures are always enabled right now -- keeping this for compatibility with VisualGestureBuilder API
     return true;
 }
Пример #11
0
 public void AddGesture(Gesture gesture)
 {
     Gestures.Add(gesture);
     myMatcher.AddGesture(gesture);
     GestureCount++;
 }
Пример #12
0
        public DiscreteGestureResult GetDiscreteGestureResult(Gesture gesture)
        {
            bool detected = false;
            bool firstFrame = false;
            float confidence = 0.0f;

            foreach (GestureStatus gs in frameResults)
            {
                if (gesture.Name.Equals(gs.GestureName))
                {
                    detected = gs.succeededDetection;
                    firstFrame = gs.succeededDetectionFirstFrame;
                    confidence = (float)gs.confidence;

                }
            }

            return new DiscreteGestureResult(detected, firstFrame, confidence);
        }
 public void SetIsEnabled(Gesture gesture, bool isEnabled)
 {
     throw new NotImplementedException();
 }
Пример #14
0
        public void AddGesture(Gesture gesture)
        {
            var matcher = new GestureMatcher(gesture);

            Matchers.Add(matcher);
        }
Пример #15
0
        private List<Gesture> CreateInterpolatedGestures(Gesture ges)
        {
            List<Gesture> retList = new List<Gesture>();

            int maxInterpolateCount = ges.Steps.Count;
            string nameStem = ges.Name + "-interpolated-";
            for (int i = 0; i < maxInterpolateCount; i++ )
            {
                // Interpolated gestures are named for the number of execution steps they have
                string interpolatedGestureName = nameStem + i.ToString();

                Gesture interpolatedGesture = new Gesture(interpolatedGestureName);

                // An interpolated gesture has all the poses of the original gesture
                // because we don't know in advance which poses will be used by the ExecutionSteps
                // CONSIDER: we could introspect on the execution steps and only copy over the needed poses
                //            -- need to check if that actually makes any difference for the formula we create
                foreach (var pose in ges.DeclaredPoses)
                {
                    interpolatedGesture.DeclaredPoses.Add(pose);
                }

                // An interpolated gesture has a subset of the ExecutionSteps of the original gesture.
                // If the original gesture has N steps, we create N interpolated gestures, each with
                // a prefix of the steps of the original gesture.
                for (int j = 0; j < i; j++)
                {
                    interpolatedGesture.Steps.Add(ges.Steps[i]);
                }
                retList.Add(interpolatedGesture);
            }
                return retList;
        }
Пример #16
0
 internal GestureMatcher(Gesture gesture)
 {
     this.Gesture = gesture;
     this.MainRestriction = "";
     if(gesture.DeclaredPoses[0].RestrictionCount > 0)
         this.MainRestriction = gesture.DeclaredPoses[0].Restriction.ToString();
     this.StepLastPercentage = 0;
     this.CompletedCount = 0;
     this.Target = null;
 }