Beispiel #1
0
            private void UpdateFramesCapture(SkeletonRenderFrames oneSecondIntervalFrames)
            {
                // Assumes the interval between frames is approximately constant. Adds an evenly spaced sample number of frames
                // to the working frames capture.

                double frameStep = oneSecondIntervalFrames.Count / GestureStandardToleranceParameters.FramesPerSecondCapture;

                if (frameStep <= 1)
                {
                    framesCapture.Add(oneSecondIntervalFrames);
                }
                else
                {
                    int count = 0;
                    foreach (DateTime timeStamp in rawFramesCapture.FramesTimeStamps)
                    {
                        if (framesCapture.Count == 0)
                        {
                            // Make sure first frame is always saved in capture.
                            framesCapture.Add(timeStamp, rawFramesCapture[timeStamp]);
                            count = 0;
                            continue;
                        }

                        count += 1;
                        if (count > frameStep)
                        {
                            framesCapture.Add(timeStamp, rawFramesCapture[timeStamp]);
                            count = 0;
                        }
                    }
                }
            }
        public GestureBuilderParameters(IGesture gesture, SkeletonRenderFrames skeletonRenderFrames, DateTime gestureStartTime, DateTime gestureEndTime, GestureBuilder.BuildStrategy buildStrategy)
        {
            this.gesture = gesture;
            this.skeletonRenderFrames = skeletonRenderFrames;

            this.gestureStartTime = gestureStartTime;
            this.gestureEndTime   = gestureEndTime;

            this.buildStrategy = buildStrategy;
        }
        public GestureBuilderParameters(IGesture gesture, SkeletonRenderFrames skeletonRenderFrames, DateTime gestureStartTime, DateTime gestureEndTime, GestureBuilder.BuildStrategy buildStrategy)
        {
            this.gesture = gesture;
            this.skeletonRenderFrames = skeletonRenderFrames;

            this.gestureStartTime = gestureStartTime;
            this.gestureEndTime = gestureEndTime;

            this.buildStrategy = buildStrategy;
        }
Beispiel #4
0
            public StandardToleranceMethod(GestureBuilderParameters parameters)
            {
                this.movingGestureTree = new MovingGestureTree();
                this.parameters        = parameters;

                this.gestureStartDateTime = DateTime.MinValue;
                this.gestureEndDateTime   = DateTime.MinValue;
                this.captureTimeTolerance = TimeSpan.Zero;
                this.gestureDuration      = TimeSpan.Zero;
                this.rawFramesCapture     = new SkeletonRenderFrames();
                this.framesCapture        = new SkeletonRenderFrames();
            }
            public StandardToleranceMethod(GestureBuilderParameters parameters)
            {
                this.movingGestureTree = new MovingGestureTree();
                this.parameters = parameters;

                this.gestureStartDateTime = DateTime.MinValue;
                this.gestureEndDateTime = DateTime.MinValue;
                this.captureTimeTolerance = TimeSpan.Zero;
                this.gestureDuration = TimeSpan.Zero;
                this.rawFramesCapture = new SkeletonRenderFrames();
                this.framesCapture = new SkeletonRenderFrames();
            }
Beispiel #6
0
            private void CalculateTotalFramesCapture()
            {
                // Sample the total frames capture. Build the working frames capture via the framesPerSecondCapture frequency.
                // Create a collection of frames existing in a one second interval (potentially longer). Sample the one
                // second collection and update the working frames capture.

                SkeletonRenderFrames oneSecondIntervalFrames = new SkeletonRenderFrames();

                TimeSpan oneSecond    = TimeSpan.FromSeconds(1);
                TimeSpan intervalSpan = TimeSpan.Zero;
                TimeSpan deltaFrameSpan;

                foreach (DateTime timeStamp in rawFramesCapture.FramesTimeStamps)
                {
                    if (intervalSpan.Equals(TimeSpan.Zero))
                    {
                        oneSecondIntervalFrames = new SkeletonRenderFrames();
                    }
                    if (parameters.SkeletonRenderFrames[timeStamp].Count == 0)
                    {
                        continue;
                    }

                    oneSecondIntervalFrames.Add(timeStamp, rawFramesCapture[timeStamp]);
                    deltaFrameSpan = TimeSpan.FromMilliseconds(DateTimeUtilities.DifferenceInMilliseconds(gestureStartDateTime, timeStamp));
                    intervalSpan   = intervalSpan.Add(deltaFrameSpan);

                    if (intervalSpan >= oneSecond)
                    {
                        UpdateFramesCapture(oneSecondIntervalFrames);
                        intervalSpan = TimeSpan.Zero;
                    }
                }

                // In case the last interval was not caught, capture it.
                if (oneSecondIntervalFrames.Count != 0)
                {
                    UpdateFramesCapture(oneSecondIntervalFrames);
                }
            }
            private void UpdateFramesCapture(SkeletonRenderFrames oneSecondIntervalFrames)
            {
                // Assumes the interval between frames is approximately constant. Adds an evenly spaced sample number of frames
                // to the working frames capture.

                double frameStep = oneSecondIntervalFrames.Count / GestureStandardToleranceParameters.FramesPerSecondCapture;

                if (frameStep <= 1)
                {
                    framesCapture.Add(oneSecondIntervalFrames);
                }
                else
                {
                    int count = 0;
                    foreach (DateTime timeStamp in rawFramesCapture.FramesTimeStamps)
                    {
                        if (framesCapture.Count == 0)
                        {
                            // Make sure first frame is always saved in capture.
                            framesCapture.Add(timeStamp, rawFramesCapture[timeStamp]);
                            count = 0;
                            continue;
                        }

                        count += 1;
                        if (count > frameStep)
                        {
                            framesCapture.Add(timeStamp, rawFramesCapture[timeStamp]);
                            count = 0;
                        }
                    }
                }
            }
            private void CalculateTotalFramesCapture()
            {
                // Sample the total frames capture. Build the working frames capture via the framesPerSecondCapture frequency.
                // Create a collection of frames existing in a one second interval (potentially longer). Sample the one
                // second collection and update the working frames capture.

                SkeletonRenderFrames oneSecondIntervalFrames = new SkeletonRenderFrames();

                TimeSpan oneSecond = TimeSpan.FromSeconds(1);
                TimeSpan intervalSpan = TimeSpan.Zero;
                TimeSpan deltaFrameSpan;

                foreach (DateTime timeStamp in rawFramesCapture.FramesTimeStamps)
                {
                    if (intervalSpan.Equals(TimeSpan.Zero)) oneSecondIntervalFrames = new SkeletonRenderFrames();
                    if (parameters.SkeletonRenderFrames[timeStamp].Count == 0) continue;

                    oneSecondIntervalFrames.Add(timeStamp, rawFramesCapture[timeStamp]);
                    deltaFrameSpan = TimeSpan.FromMilliseconds(DateTimeUtilities.DifferenceInMilliseconds(gestureStartDateTime, timeStamp));
                    intervalSpan = intervalSpan.Add(deltaFrameSpan);

                    if (intervalSpan >= oneSecond)
                    {
                        UpdateFramesCapture(oneSecondIntervalFrames);
                        intervalSpan = TimeSpan.Zero;
                    }
                }

                // In case the last interval was not caught, capture it.
                if (oneSecondIntervalFrames.Count != 0) UpdateFramesCapture(oneSecondIntervalFrames);
            }