KevinLTT / video2bvh

Extracts human motion in video and save it as bvh mocap file.
MIT License
580 stars 90 forks source link

请问left_hand和right_hand如何表示 #39

Open birdflies opened 3 years ago

birdflies commented 3 years ago

您好,请问left_hand和right_hand如何表示的空间坐标应该怎么计算啊?

 while stack:
            node = stack.pop()
            joint = node.name
            joint_idx = self.keypoint2index[joint]

            if node.is_root:
                channel.extend(pose[joint_idx])

            index = self.keypoint2index
            order = None
            if joint == 'Hips':
                x_dir = pose[index['LeftUpLeg']] - pose[index['RightUpLeg']]
                y_dir = None
                z_dir = pose[index['Spine']] - pose[joint_idx]
                order = 'zyx'
            elif joint in ['RightUpLeg', 'RightLeg']:
                child_idx = self.keypoint2index[node.children[0].name]
                x_dir = pose[index['Hips']] - pose[index['RightUpLeg']]
                y_dir = None
                z_dir = pose[joint_idx] - pose[child_idx]
                order = 'zyx'
            elif joint in ['LeftUpLeg', 'LeftLeg']:
                child_idx = self.keypoint2index[node.children[0].name]
                x_dir = pose[index['LeftUpLeg']] - pose[index['Hips']]
                y_dir = None
                z_dir = pose[joint_idx] - pose[child_idx]
                order = 'zyx'
            elif joint == 'Spine':
                x_dir = pose[index['LeftUpLeg']] - pose[index['RightUpLeg']]
                y_dir = None
                z_dir = pose[index['Spine1']] - pose[joint_idx]
                order = 'zyx'
            elif joint == 'Spine1':
                x_dir = pose[index['LeftArm']] - \
                    pose[index['RightArm']]
                y_dir = None
                z_dir = pose[joint_idx] - pose[index['Spine']]
                order = 'zyx'
            elif joint == 'Neck1':
                x_dir = None
                y_dir = pose[index['Spine1']] - pose[joint_idx]
                z_dir = pose[index['HeadEndSite']] - pose[index['Spine1']]
                order = 'zxy'
            elif joint == 'LeftArm':
                x_dir = pose[index['LeftForeArm']] - pose[joint_idx]
                y_dir = pose[index['LeftForeArm']] - pose[index['LeftHand']]
                z_dir = None
                order = 'xzy'
            elif joint == 'LeftForeArm':
                x_dir = pose[index['LeftHand']] - pose[joint_idx]
                y_dir = pose[joint_idx] - pose[index['LeftArm']]
                z_dir = None
                order = 'xzy'
            elif joint == 'RightArm':
                x_dir = pose[joint_idx] - pose[index['RightForeArm']]
                y_dir = pose[index['RightForeArm']] - pose[index['RightHand']]
                z_dir = None
                order = 'xzy'
            elif joint == 'RightForeArm':
                x_dir = pose[joint_idx] - pose[index['RightHand']]
                y_dir = pose[joint_idx] - pose[index['RightArm']]
                z_dir = None
                order = 'xzy'