예제 #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
파일: Validity.cs 프로젝트: caomw/prepose
        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
파일: Program.cs 프로젝트: caomw/prepose
        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
파일: Ambiguity.cs 프로젝트: caomw/prepose
 public PairwiseConflictException(string message, Gesture gesture1, Gesture gesture2, Z3Body body)
     : base(message)
 {
     this.Witness = body;
     this.Gesture1 = gesture1;
     this.Gesture2 = gesture2;
 }
예제 #7
0
파일: Safety.cs 프로젝트: lsfcin/prepose
        /// <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
파일: Program.cs 프로젝트: lsfcin/prepose
        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;
 }