Ejemplo n.º 1
0
        internal void SetDeviation(int sequenceIndex, int frameIndex, float poseDeviation, float trajectoryDeviation)
        {
            Assert.IsTrue(sequenceIndex < sequences.Length);
            Assert.IsTrue(frameIndex < sequences[sequenceIndex].sequence.numFrames);

            int deviationIndex = sequences[sequenceIndex].firstDeviationIndex + frameIndex;

            deviations[deviationIndex] = new DeviationScore()
            {
                poseDeviation       = poseDeviation,
                trajectoryDeviation = trajectoryDeviation
            };
        }
        string GetCostInformation(ref Binary binary, ref DeviationTable deviationTable, SamplingTime samplingTime)
        {
            if (!deviationTable.IsValid || !samplingTime.IsValid)
            {
                return("");
            }

            DeviationScore deviation = deviationTable.GetDeviation(ref binary, samplingTime.timeIndex);

            if (!deviation.IsValid)
            {
                return($"\nThis fragment wasn't considered during the query");
            }

            if (deviation.trajectoryDeviation >= 0.0f)
            {
                return($"\n<b>Pose cost:</b> {deviation.poseDeviation:0.000}, <b>Trajectory:</b> {deviation.trajectoryDeviation:0.000}, <b>Total:</b> {deviation.poseDeviation + deviation.trajectoryDeviation:0.000}");
            }
            else
            {
                return($"\n<b>Pose cost:</b> {deviation.poseDeviation:0.000}");
            }
        }
Ejemplo n.º 3
0
        internal static DeviationTable Create(PoseSet candidates)
        {
            int numDeviations = 0;

            for (int i = 0; i < candidates.sequences.Length; ++i)
            {
                numDeviations += candidates.sequences[i].numFrames;
            }

            DeviationTable table = new DeviationTable()
            {
                allocator  = Allocator.Temp,
                sequences  = new NativeArray <PoseSequenceInfo>(candidates.sequences.Length, Allocator.Temp),
                deviations = new NativeArray <DeviationScore>(numDeviations, Allocator.Temp)
            };

            int deviationIndex = 0;

            for (int i = 0; i < candidates.sequences.Length; ++i)
            {
                table.sequences[i] = new PoseSequenceInfo()
                {
                    sequence            = candidates.sequences[i],
                    firstDeviationIndex = deviationIndex
                };

                deviationIndex += candidates.sequences[i].numFrames;
            }

            for (int i = 0; i < numDeviations; ++i)
            {
                table.deviations[i] = DeviationScore.CreateInvalid();
            }

            return(table);
        }