Exemplo n.º 1
0
        /// <summary>
        /// Adds the torsopoints to body
        /// </summary>
        /// /// <remarks>
        /// If the current body id had tracking in previous frames, the average torso location the last frames is saved.
        /// </remarks>
        public void AddTorso(List <int> torsoPoints)
        {
            CameraSpacePoint currentAvg = BodyUtils.CalculateAveragePointFromValidPoints(torsoPoints);

            if (BodyUtils.HasTorsoTracking(Id))
            {
                CameraSpacePoint avgLastFrames = BodyUtils.GetAverageTorsoLocationLastFrames(Id);

                if (GlobUtils.GetEuclideanDistance(avgLastFrames, currentAvg) < Thresholds.LastFramesTorsoMaxDistance)
                {
                    Torso torso = new Torso(currentAvg, avgLastFrames);
                    Torso = torso;
                }
                else
                {
                    Torso torso = new Torso(currentAvg, new CameraSpacePoint()
                    {
                        X = float.NaN, Y = float.NaN, Z = float.NaN
                    });
                    Torso = torso;
                }
            }
            else
            {
                Torso torso = new Torso(currentAvg, new CameraSpacePoint()
                {
                    X = float.NaN, Y = float.NaN, Z = float.NaN
                });
                Torso = torso;
            }
        }
        /// <summary>
        /// Adds the torsopoints to body
        /// </summary>
        /// /// <remarks> 
        /// If the current body id had tracking in previous frames, the average torso location the last frames is saved. 
        /// </remarks> 
        public void AddTorso(List<int> torsoPoints)
        {
            CameraSpacePoint currentAvg = BodyUtils.CalculateAveragePointFromValidPoints(torsoPoints);
            if (BodyUtils.HasTorsoTracking(Id))
            {
                CameraSpacePoint avgLastFrames = BodyUtils.GetAverageTorsoLocationLastFrames(Id);

                if (GlobUtils.GetEuclideanDistance(avgLastFrames, currentAvg) < Thresholds.LastFramesTorsoMaxDistance)
                {
                    Torso torso = new Torso(currentAvg, avgLastFrames);
                    Torso = torso;
                }
                else
                {
                    Torso torso = new Torso(currentAvg, new CameraSpacePoint() { X = float.NaN, Y = float.NaN, Z = float.NaN });
                    Torso = torso;
                }
            }
            else
            {
                Torso torso = new Torso(currentAvg, new CameraSpacePoint() { X = float.NaN, Y = float.NaN, Z = float.NaN });
                Torso = torso;
            }
        }