예제 #1
0
        /// <summary>
        /// Extract the concatenated feature vector from a skeleton
        /// </summary>
        /// <param name="s">A processed Skeleton</param>
        /// <returns>The concatenated feature vector</returns>
        public static double[] FeatureSet(Skeleton s)
        {
            SkeletonFeatureFrame sff = new SkeletonFeatureFrame(s);
            var features = new double[31];
            int nextFreeIndex = 0;

            nextFreeIndex = AddFeat(sff, SkeletonFeatureFrame.DirectionVectors.ArmLeft, features, nextFreeIndex);
            nextFreeIndex = AddFeat(sff, SkeletonFeatureFrame.DirectionVectors.ArmRight, features, nextFreeIndex);
            nextFreeIndex = AddFeat(sff, SkeletonFeatureFrame.DirectionVectors.ForeArmLeft, features, nextFreeIndex);
            nextFreeIndex = AddFeat(sff, SkeletonFeatureFrame.DirectionVectors.ForeArmLeft, features, nextFreeIndex);
            nextFreeIndex = AddFeat(sff, SkeletonFeatureFrame.DirectionVectors.HandLeft, features, nextFreeIndex);
            nextFreeIndex = AddFeat(sff, SkeletonFeatureFrame.DirectionVectors.HandRight, features, nextFreeIndex);
            nextFreeIndex = AddFeat(sff, SkeletonFeatureFrame.DirectionVectors.ShoulderBladeLeft, features, nextFreeIndex);
            nextFreeIndex = AddFeat(sff, SkeletonFeatureFrame.DirectionVectors.ShoulderBladeRight, features, nextFreeIndex);
            nextFreeIndex = AddFeat(sff, SkeletonFeatureFrame.DirectionVectors.BetweenHands, features, nextFreeIndex);

            features[nextFreeIndex++] = sff.Angle(SkeletonFeatureFrame.Angles.AngleElbowLeft);
            features[nextFreeIndex++] = sff.Angle(SkeletonFeatureFrame.Angles.AngleElbowRight);
            features[nextFreeIndex++] = sff.Angle(SkeletonFeatureFrame.Angles.AngleShoulderLeft);
            features[nextFreeIndex++] = sff.Angle(SkeletonFeatureFrame.Angles.AngleShoulderRight);

            if (nextFreeIndex != features.Length) throw new Exception("Missing features");

            return features;
        }