导出坐标点
作者您好,我想导出SMPL模型的22个点坐标,目前在用Blender导入.obj文件运行python脚本去获取,程序如下: import bpy import numpy as np
mesh = bpy.context.object.data
weights = np.ones(len(mesh.vertices)) matrices = np.array([bpy.context.object.matrix_world.inverted()] * len(mesh.vertices))
joint_indices = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 19, 20, 21,22,23] joint_matrices = matrices[:, joint_indices] joint_weights = weights[:, joint_indices] joint_weights /= np.sum(joint_weights, axis=1, keepdims=True) joint_positions = np.sum(joint_matrices * joint_weights[:, :, np.newaxis], axis=1)
for i, pos in enumerate(joint_positions): print("Joint {}: ({:.4f}, {:.4f}, {:.4f})".format(i+1, pos[0], pos[1], pos[2])) 恳请您帮我看一下问题出在哪里,或者使用其他方式获取坐标。谢谢!