コード例 #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
ファイル: BodyMatching.cs プロジェクト: caomw/prepose
 public void AddGesture(Gesture gesture)
 {
     var matcher = new GestureMatcher(gesture);
     Matchers.Add(matcher);
 }
コード例 #5
0
ファイル: BodyMatching.cs プロジェクト: caomw/prepose
 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);
        }
コード例 #13
0
 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
ファイル: BodyMatching.cs プロジェクト: lsfcin/prepose
 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;
 }