BVH to SMPL
将BVH
文件转换为SMPL
模型,需要使用专业的3D建模软件。
例如
Blender或Maya。
Steps
- 导入BVH文件到建模软件中。
- 将BVH文件应用于一个适当的人体模型。
- 将人体模型转换为SMPL模型。
- 导出SMPL模型文件。
Realization
https://github.com/Meshcapade/SMPL_blender_addon
https://smpl-x.is.tue.mpg.de/
https://github.com/Rokoko/rokoko-studio-live-blender
- 下载 SMPL Model
- 安装 (
edit
–>preference
) - 应用(
add ons
)
SMPL ==> Frame 保存
Realize SMPL to Frame.npy through Scripting
Import
- NumPy
- Blender Python
import bpy
import numpy as np
SMPL list
SMPLX_JOINT_NAMES = [
'pelvis','left_hip','right_hip','spine1','left_knee','right_knee','spine2','left_ankle','right_ankle','spine3',
]
Frame list
frame_len = bpy.context.scene.frame_end
frames = []
Frame Synthesis
for fIdx in range(frame_len):
print(fIdx)
bpy.context.scene.frame_set(fIdx)
################################
obj = bpy.data.objects.get('SMPLX-mesh-female')
if obj is None:
print("WARN: no obj {}".format(tar_name))
break
if obj.type == 'MESH':
armature = obj.parent
else:
armature = obj
# Get armature pose in rodrigues representation
pose = [0.0] * (NUM_SMPLX_JOINTS * 3)
for index in range(NUM_SMPLX_JOINTS):
joint_name = SMPLX_JOINT_NAMES[index]
joint_pose = rodrigues_from_pose(armature, joint_name)
pose[index*3 + 0] = joint_pose[0]
pose[index*3 + 1] = joint_pose[1]
pose[index*3 + 2] = joint_pose[2]
################################
frames.append(pose)
Save
seq_name = "ABCD."
np.save("PATH{}.npy".format(seq_name), frames)