コード例 #1
0
        internal void UpdateTargetBody(Z3Body startBody)
        {
            // delayed statements are a special case
            // they can be treated as restrictions or as transformations
            // in order to the pose to retrieve the composite restrictions and transformations
            // we must first provide the start body to update its delayed statements
            // so they are treated first on the update target function
            this.Gesture.Steps[this.CurrentStep].Pose.UpdateDelayedStatements(startBody);

            var stopwatch = new Stopwatch();
            StatisticsEntrySynthesize synTime = new StatisticsEntrySynthesize();

            stopwatch.Start();
            var time0 = stopwatch.ElapsedMilliseconds;

            if (this.Target != null && this.CurrentStep > 0)
            {
                // If last target is not null than use the target transformed joints instead of the start transformed joints
                // This way no error is cumulated along the transforms due to the matching precisions
                foreach (var jointType in this.Gesture.Steps[this.CurrentStep - 1].Pose.GetTransformJointTypes())
                {
                    // The Z3Point3D depends on a specific Z3 context deep underneath
                    // We need to thread the context through
                    startBody.Joints[jointType] =
                        new Z3Point3D(
                            Z3Math.GetRealValue(this.Target.Body.Joints[jointType].X),
                            Z3Math.GetRealValue(this.Target.Body.Joints[jointType].Y),
                            Z3Math.GetRealValue(this.Target.Body.Joints[jointType].Z),
                            Z3.Context);
                }
            }

            this.Target = this.Gesture.Steps[this.CurrentStep].Pose.CalcNearestTargetBody(startBody);
            this.LastDistanceVectors = UpdateDistanceVectors(startBody, Z3.Context);

            var time1 = stopwatch.ElapsedMilliseconds - time0;

            stopwatch.Stop();

            synTime.timeMs      = time1;
            synTime.gestureName = this.Gesture.Name;
            synTime.poseName    = this.Gesture.Steps[CurrentStep].Pose.Name;
            synTime.uid         = frameCount;
            GestureStatistics.synthTimes.Add(synTime);
            frameCount++;
        }
コード例 #2
0
        internal void UpdateTargetBody(Z3Body start, Context localZ3Context)
        {
            var stopwatch = new Stopwatch();
            StatisticsEntrySynthesize synTime = new StatisticsEntrySynthesize();

            stopwatch.Start();
            var time0 = stopwatch.ElapsedMilliseconds;

            if (this.Target != null && this.CurrentStep > 0)
            {
                // If last target is not null than use the target transformed joints instead of the start transformed joints
                // This way no error is cumulated along the transforms due to the matching precisions
                foreach (var jointType in this.Gesture.Steps[this.CurrentStep - 1].Pose.GetTransformJointTypes())
                {
                    // The Z3Point3D depends on a specific Z3 context deep underneath
                    // We need to thread the context through
                    start.Joints[jointType] =
                        new Z3Point3D(
                            Z3Math.GetRealValue(this.Target.Body.Joints[jointType].X),
                            Z3Math.GetRealValue(this.Target.Body.Joints[jointType].Y),
                            Z3Math.GetRealValue(this.Target.Body.Joints[jointType].Z),
                            localZ3Context);
                }
            }

            this.Target = this.Gesture.Steps[this.CurrentStep].Pose.CalcNearestTargetBody(start);
            this.LastDistanceVectors = UpdateDistanceVectors(start, Z3.Context);

            var time1 = stopwatch.ElapsedMilliseconds - time0;

            stopwatch.Stop();

            synTime.timeMs      = time1;
            synTime.gestureName = this.Gesture.Name;
            synTime.poseName    = this.Gesture.Steps[CurrentStep].Pose.Name;
            synTime.uid         = frameCount;
            //totalZ3Time += time1;
            frameCount++;
            GestureStatistics.synthTimes.Add(synTime);

            //Console.Write("z3time: " + (totalZ3Time / frameCount) + "                       \r");
        }
コード例 #3
0
ファイル: BodyMatching.cs プロジェクト: caomw/prepose
        internal void UpdateTargetBody(Z3Body start, Context localZ3Context)
        {
            var stopwatch = new Stopwatch();
            StatisticsEntrySynthesize synTime = new StatisticsEntrySynthesize();
            stopwatch.Start();
            var time0 = stopwatch.ElapsedMilliseconds;

            if (this.Target != null && this.CurrentStep > 0)
            {
                // If last target is not null than use the target transformed joints instead of the start transformed joints
                // This way no error is cumulated along the transforms due to the matching precisions
                foreach (var jointType in this.Gesture.Steps[this.CurrentStep - 1].Pose.GetTransformJointTypes())
                {
                    // The Z3Point3D depends on a specific Z3 context deep underneath
                    // We need to thread the context through
                    start.Joints[jointType] =
                        new Z3Point3D(
                            Z3Math.GetRealValue(this.Target.Body.Joints[jointType].X),
                            Z3Math.GetRealValue(this.Target.Body.Joints[jointType].Y),
                            Z3Math.GetRealValue(this.Target.Body.Joints[jointType].Z),
                            localZ3Context);
                }
            }

            this.Target = this.Gesture.Steps[this.CurrentStep].Pose.CalcNearestTargetBody(start);
            this.LastDistanceVectors = UpdateDistanceVectors(start, Z3.Context);

            var time1 = stopwatch.ElapsedMilliseconds - time0;
            stopwatch.Stop();

            synTime.timeMs = time1;
            synTime.gestureName = this.Gesture.Name;
            synTime.poseName = this.Gesture.Steps[CurrentStep].Pose.Name;
            synTime.uid = frameCount;
            //totalZ3Time += time1;
            frameCount++;
            GestureStatistics.synthTimes.Add(synTime);

            //Console.Write("z3time: " + (totalZ3Time / frameCount) + "                       \r");
        }
コード例 #4
0
ファイル: BodyMatching.cs プロジェクト: lsfcin/prepose
        internal void UpdateTargetBody(Z3Body startBody)
        {
            // delayed statements are a special case
            // they can be treated as restrictions or as transformations
            // in order to the pose to retrieve the composite restrictions and transformations
            // we must first provide the start body to update its delayed statements
            // so they are treated first on the update target function
            this.Gesture.Steps[this.CurrentStep].Pose.UpdateDelayedStatements(startBody);

            var stopwatch = new Stopwatch();
            StatisticsEntrySynthesize synTime = new StatisticsEntrySynthesize();
            stopwatch.Start();
            var time0 = stopwatch.ElapsedMilliseconds;

            if (this.Target != null && this.CurrentStep > 0)
            {
                // If last target is not null than use the target transformed joints instead of the start transformed joints
                // This way no error is cumulated along the transforms due to the matching precisions
                foreach (var jointType in this.Gesture.Steps[this.CurrentStep - 1].Pose.GetTransformJointTypes())
                {
                    // The Z3Point3D depends on a specific Z3 context deep underneath
                    // We need to thread the context through
                    startBody.Joints[jointType] =
                        new Z3Point3D(
                            Z3Math.GetRealValue(this.Target.Body.Joints[jointType].X),
                            Z3Math.GetRealValue(this.Target.Body.Joints[jointType].Y),
                            Z3Math.GetRealValue(this.Target.Body.Joints[jointType].Z),
                            Z3.Context);
                }
            }

            this.Target = this.Gesture.Steps[this.CurrentStep].Pose.CalcNearestTargetBody(startBody);
            this.LastDistanceVectors = UpdateDistanceVectors(startBody, Z3.Context);

            var time1 = stopwatch.ElapsedMilliseconds - time0;
            stopwatch.Stop();

            synTime.timeMs = time1;
            synTime.gestureName = this.Gesture.Name;
            synTime.poseName = this.Gesture.Steps[CurrentStep].Pose.Name;
            synTime.uid = frameCount;
            GestureStatistics.synthTimes.Add(synTime);
            frameCount++;
        }