Helper class used to compute features given a set of data points from a Nintendo Wiimote and/or MotionPlus.
Пример #1
0
        /// <summary>
        /// Will recompute the feature vector.
        /// </summary>
        /// <param name="typeOfFeaturesToCompute">indicates the type of features to be computed.</param>
        public void ComputeFeatures(GestureFeatures typeOfFeaturesToCompute)
        {
            if (Config.Use3DMode)
            {
                Compute3DFeatures(typeOfFeaturesToCompute);
                return;
            }

            List <float>   allFeatures = new List <float>();
            XYFeatures     points = null, inversePoints = null, velocities = null, inverseVelocities = null;
            StrokeFeatures strokes = null;

            switch (typeOfFeaturesToCompute)
            {
            case GestureFeatures.Points:
                points = new XYFeatures(InterpretedPoints);
                break;

            case GestureFeatures.PointsStroke:
                points  = new XYFeatures(InterpretedPoints);
                strokes = new StrokeFeatures(StrokePoints);
                break;

            case GestureFeatures.PointsStrokeInverse:
                points        = new XYFeatures(InterpretedPoints);
                strokes       = new StrokeFeatures(StrokePoints);
                inversePoints = new XYFeatures(InterpretedPoints);
                break;

            case GestureFeatures.PointsVelocities:
                points     = new XYFeatures(InterpretedPoints);
                velocities = new XYFeatures(Velocities);
                break;

            case GestureFeatures.PointsVelocitiesInverseVelocities:
                points            = new XYFeatures(InterpretedPoints);
                velocities        = new XYFeatures(Velocities);
                inverseVelocities = new XYFeatures(InverseVelocities);
                break;

            case GestureFeatures.PointsStrokesVelocitiesInverseVelocities:
                points            = new XYFeatures(InterpretedPoints);
                velocities        = new XYFeatures(Velocities);
                inverseVelocities = new XYFeatures(InverseVelocities);
                strokes           = new StrokeFeatures(StrokePoints);
                break;
            }

            //allFeatures.AddRange(SpeakerAngles);
            allFeatures.AddRange(points.NormalFeatures);
            if (inversePoints != null)
            {
                allFeatures.AddRange(inversePoints.VelocityFeatures);
            }
            if (velocities != null)
            {
                allFeatures.AddRange(velocities.VelocityFeatures);
            }
            if (inverseVelocities != null)
            {
                allFeatures.AddRange(inverseVelocities.VelocityFeatures);
            }
            if (strokes != null)
            {
                allFeatures.AddRange(strokes.NormalFeatures);
            }

            allFeatures.Add(this.Duration);
            Features = allFeatures.ToArray();
        }
Пример #2
0
        /// <summary>
        /// Will recompute the feature vector.
        /// </summary>
        /// <param name="typeOfFeaturesToCompute">indicates the type of features to be computed.</param>
        public void ComputeFeatures(GestureFeatures typeOfFeaturesToCompute)
        {
            if (Config.Use3DMode)
            {
                Compute3DFeatures(typeOfFeaturesToCompute);
                return;
            }

            List<float> allFeatures = new List<float>();
            XYFeatures points = null, inversePoints = null, velocities = null, inverseVelocities = null;
            StrokeFeatures strokes = null;

            switch (typeOfFeaturesToCompute)
            {
                case GestureFeatures.Points:
                    points = new XYFeatures(InterpretedPoints);
                    break;
                case GestureFeatures.PointsStroke:
                    points = new XYFeatures(InterpretedPoints);
                    strokes = new StrokeFeatures(StrokePoints);
                    break;
                case GestureFeatures.PointsStrokeInverse:
                    points = new XYFeatures(InterpretedPoints);
                    strokes = new StrokeFeatures(StrokePoints);
                    inversePoints = new XYFeatures(InterpretedPoints);
                    break;
                case GestureFeatures.PointsVelocities:
                    points = new XYFeatures(InterpretedPoints);
                    velocities = new XYFeatures(Velocities);
                    break;
                case GestureFeatures.PointsVelocitiesInverseVelocities:
                    points = new XYFeatures(InterpretedPoints);
                    velocities = new XYFeatures(Velocities);
                    inverseVelocities = new XYFeatures(InverseVelocities);
                    break;
                case GestureFeatures.PointsStrokesVelocitiesInverseVelocities:
                    points = new XYFeatures(InterpretedPoints);
                    velocities = new XYFeatures(Velocities);
                    inverseVelocities = new XYFeatures(InverseVelocities);
                    strokes = new StrokeFeatures(StrokePoints);
                    break;
            }

            //allFeatures.AddRange(SpeakerAngles);
            allFeatures.AddRange(points.NormalFeatures);
            if (inversePoints != null)
                allFeatures.AddRange(inversePoints.VelocityFeatures);
            if (velocities != null)
                allFeatures.AddRange(velocities.VelocityFeatures);
            if (inverseVelocities != null)
                allFeatures.AddRange(inverseVelocities.VelocityFeatures);
            if (strokes != null)
                allFeatures.AddRange(strokes.NormalFeatures);

            allFeatures.Add(this.Duration);
            Features = allFeatures.ToArray();
        }