BrianG13 / FLEX

FLEX: Parameter-free Multi-view 3D Human Motion Reconstruction
47 stars 3 forks source link

Bone hierarchy for generating BVH #12

Closed UsamaShaikh1 closed 1 year ago

UsamaShaikh1 commented 1 year ago

Thank you for your excellent work, i am trying to create a bvh file using bone hierarchy. Can you please guide me where to find this. Similar to this fashion @BrianG13 hierarchy = {'hips': [], 'hips2': ['hips'], 'lefthip': ['hips'], 'leftknee': ['lefthip', 'hips'], 'leftfoot': ['leftknee', 'lefthip', 'hips'], 'righthip': ['hips'], 'rightknee': ['righthip', 'hips'], 'rightfoot': ['rightknee', 'righthip', 'hips'], 'middleback':['hips2','hips'], 'neck': ['middleback','hips2','hips'], 'neck2': ['neck','middleback','hips2','hips'], 'neck3': ['neck', 'middleback', 'hips2','hips'], 'leftshoulder': ['neck','middleback', 'hips2','hips'], 'leftelbow': ['leftshoulder','neck','middleback', 'hips2','hips'], 'leftwrist': ['leftelbow', 'leftshoulder', 'neck','middleback', 'hips2','hips'], 'rightshoulder': ['neck','middleback', 'hips2','hips'], 'rightelbow': ['rightshoulder', 'neck','middleback', 'hips2','hips'], 'rightwrist': ['rightelbow', 'rightshoulder', 'neck','middleback', 'hips2','hips'], 'middlehead': ['neck','middleback', 'hips2','hips'], 'tophead': ['middlehead', 'neck','middleback', 'hips2','hips'],}

BrianG13 commented 1 year ago

You need to track the creation of the BVH file through the code.

This is a good place to start: https://github.com/BrianG13/FLEX/blob/79d6d0a91941b76075d504043fc80646ac1f1878/evaluate_multiview.py#L62

This line: https://github.com/BrianG13/FLEX/blob/79d6d0a91941b76075d504043fc80646ac1f1878/utils/Animation.py#L1299 configures the parent joint for each joint in the joints hierarchy.

PARENTS = [-1, 0, 1, 2, 0, 4, 5, 0, 7, 8, 9, 10, 8, 12, 13, 14, 8, 16, 17, 18] Joint #0 parent = -1 , means it is the root joint, no parent Joint #1 parents = 0 , means Joint#0 is his parent joint and etc..

Notice that a joint can only have one parent, but a joint can be a parent for various joint, here Joint#0 is an example for this case.