コード例 #1
0
        public void SkeletonEstimatorTestLA(string filename)
        {
            var path      = Path.Combine(TestModelPath.FullName, filename);
            var text      = File.ReadAllText(path, Encoding.UTF8);
            var bvh       = BvhParser.Parse(text);
            var model     = ModelExtensionsForBvh.CreateFromBvh(bvh.Root);
            var estimated = SkeletonEstimator.Detect(model.Root);

            Assert.AreEqual(estimated[HumanoidBones.hips].Name, "Hips");
            Assert.AreEqual(estimated[HumanoidBones.spine].Name, "Chest");
            Assert.AreEqual(estimated[HumanoidBones.chest].Name, "Chest2");
            Assert.AreEqual(estimated[HumanoidBones.neck].Name, "Neck");
            Assert.AreEqual(estimated[HumanoidBones.head].Name, "Head");
            Assert.AreEqual(estimated[HumanoidBones.leftShoulder].Name, "LeftCollar");
            Assert.AreEqual(estimated[HumanoidBones.leftUpperArm].Name, "LeftShoulder");
            Assert.AreEqual(estimated[HumanoidBones.leftLowerArm].Name, "LeftElbow");
            Assert.AreEqual(estimated[HumanoidBones.leftHand].Name, "LeftWrist");
            Assert.AreEqual(estimated[HumanoidBones.rightShoulder].Name, "RightCollar");
            Assert.AreEqual(estimated[HumanoidBones.rightUpperArm].Name, "RightShoulder");
            Assert.AreEqual(estimated[HumanoidBones.rightLowerArm].Name, "RightElbow");
            Assert.AreEqual(estimated[HumanoidBones.rightHand].Name, "RightWrist");
            Assert.AreEqual(estimated[HumanoidBones.leftUpperLeg].Name, "LeftHip");
            Assert.AreEqual(estimated[HumanoidBones.leftLowerLeg].Name, "LeftKnee");
            Assert.AreEqual(estimated[HumanoidBones.leftFoot].Name, "LeftAnkle");
            Assert.AreEqual(estimated[HumanoidBones.rightUpperLeg].Name, "RightHip");
            Assert.AreEqual(estimated[HumanoidBones.rightLowerLeg].Name, "RightKnee");
            Assert.AreEqual(estimated[HumanoidBones.rightFoot].Name, "RightAnkle");
        }
コード例 #2
0
        public void SkeletonEstimatorTest(string filename)
        {
            var path = Path.Combine(RootPath.FullName, filename);
            var text = File.ReadAllText(path, Encoding.UTF8);
            var bvh  = BvhParser.Parse(text);

            var model = ModelExtensionsForBvh.CreateFromBvh(bvh.Root);

            var estimated = SkeletonEstimator.Detect(model.Root);

            Assert.AreEqual(estimated[HumanoidBones.hips].Name, "Hips");
            Assert.AreEqual(estimated[HumanoidBones.spine].Name, "Spine");
            Assert.AreEqual(estimated[HumanoidBones.chest].Name, "Spine1");
            Assert.AreEqual(estimated[HumanoidBones.neck].Name, "Neck");
            Assert.AreEqual(estimated[HumanoidBones.head].Name, "Head");
            Assert.AreEqual(estimated[HumanoidBones.leftShoulder].Name, "LeftShoulder");
            Assert.AreEqual(estimated[HumanoidBones.leftUpperArm].Name, "LeftArm");
            Assert.AreEqual(estimated[HumanoidBones.leftLowerArm].Name, "LeftForeArm");
            Assert.AreEqual(estimated[HumanoidBones.leftHand].Name, "LeftHand");
            Assert.AreEqual(estimated[HumanoidBones.rightShoulder].Name, "RightShoulder");
            Assert.AreEqual(estimated[HumanoidBones.rightUpperArm].Name, "RightArm");
            Assert.AreEqual(estimated[HumanoidBones.rightLowerArm].Name, "RightForeArm");
            Assert.AreEqual(estimated[HumanoidBones.rightHand].Name, "RightHand");
            Assert.AreEqual(estimated[HumanoidBones.leftUpperLeg].Name, "LeftUpLeg");
            Assert.AreEqual(estimated[HumanoidBones.leftLowerLeg].Name, "LeftLeg");
            Assert.AreEqual(estimated[HumanoidBones.leftFoot].Name, "LeftFoot");
            Assert.AreEqual(estimated[HumanoidBones.leftToes].Name, "LeftToeBase");
            Assert.AreEqual(estimated[HumanoidBones.rightUpperLeg].Name, "RightUpLeg");
            Assert.AreEqual(estimated[HumanoidBones.rightLowerLeg].Name, "RightLeg");
            Assert.AreEqual(estimated[HumanoidBones.rightFoot].Name, "RightFoot");
            Assert.AreEqual(estimated[HumanoidBones.rightToes].Name, "RightToeBase");
        }
コード例 #3
0
        public void BvhTest(string filename)
        {
            var path = Path.Combine(RootPath.FullName, filename);
            var text = File.ReadAllText(path, Encoding.UTF8);
            var bvh  = BvhParser.Parse(text);

            Assert.AreEqual(4007, bvh.FrameCount);

            var model = ModelExtensionsForBvh.Load(Path.GetFileName(path), bvh);
        }
コード例 #4
0
    private void Parse()
    {
        string fp = System.IO.Path.Combine(Application.streamingAssetsPath, "walk_loop.bvh");

        Debug.Log(fp);

        _bp.GetTokenInfo(fp);
        if (_bp.Parse(_bvh) == 0)
        {
            _bvh.Cal();
        }
    }
コード例 #5
0
    public void Parse(string info)
    {
        _bvh        = new Bvh();
        _bp         = new BvhParser();
        _frameIndex = 0;
        _pathIndex  = 0;

        _bp.GetTokenInfo(info);
        if (_bp.Parse(_bvh) == 0)
        {
            _bvh.Cal();
            return(0);
        }
        return(-1);
    }
コード例 #6
0
        public void SkeletonEstimatorTestAccad(string filename)
        {
            var path  = Path.Combine(TestModelPath.FullName, filename);
            var text  = File.ReadAllText(path, Encoding.UTF8);
            var bvh   = BvhParser.Parse(text);
            var bones = bvh.Root.Traverse().ToArray();

            foreach (var bone in bones)
            {
                Console.WriteLine(bone.Name);
            }
            var model     = ModelExtensionsForBvh.CreateFromBvh(bvh.Root);
            var estimated = SkeletonEstimator.Detect(model.Root);

            Assert.AreEqual(estimated[HumanoidBones.hips].Name, "root");
            Assert.AreEqual(estimated[HumanoidBones.spine].Name, "lowerback");
            Assert.AreEqual(estimated[HumanoidBones.chest].Name, "upperback");
            Assert.AreEqual(estimated[HumanoidBones.upperChest].Name, "thorax");
            Assert.AreEqual(estimated[HumanoidBones.neck].Name, "neck");
            Assert.AreEqual(estimated[HumanoidBones.head].Name, "head");
            Assert.AreEqual(estimated[HumanoidBones.leftShoulder].Name, "lshoulderjoint");
            Assert.AreEqual(estimated[HumanoidBones.leftUpperArm].Name, "lhumerus");
            Assert.AreEqual(estimated[HumanoidBones.leftLowerArm].Name, "lradius");
            Assert.AreEqual(estimated[HumanoidBones.leftHand].Name, "lhand");
            Assert.AreEqual(estimated[HumanoidBones.rightShoulder].Name, "rshoulderjoint");
            Assert.AreEqual(estimated[HumanoidBones.rightUpperArm].Name, "rhumerus");
            Assert.AreEqual(estimated[HumanoidBones.rightLowerArm].Name, "rradius");
            Assert.AreEqual(estimated[HumanoidBones.rightHand].Name, "rhand");
            Assert.AreEqual(estimated[HumanoidBones.rightUpperLeg].Name, "rfemur");
            Assert.AreEqual(estimated[HumanoidBones.rightLowerLeg].Name, "rtibia");
            Assert.AreEqual(estimated[HumanoidBones.rightFoot].Name, "rfoot");
            Assert.AreEqual(estimated[HumanoidBones.rightToes].Name, "rtoes");
            Assert.AreEqual(estimated[HumanoidBones.leftUpperLeg].Name, "lfemur");
            Assert.AreEqual(estimated[HumanoidBones.leftLowerLeg].Name, "ltibia");
            Assert.AreEqual(estimated[HumanoidBones.leftFoot].Name, "lfoot");
            Assert.AreEqual(estimated[HumanoidBones.leftToes].Name, "ltoes");
        }