首页 星云 工具 资源 星选 资讯 热门工具
:

PDF转图片 完全免费 小红书视频下载 无水印 抖音视频下载 无水印 数字星空

npy3d世界坐标转bvh

大数据 34.72KB 22 需要积分: 1
立即下载

资源介绍:

npy3d世界坐标转bvh
from . import math3d_SmartBody from . import bvh_helper_SmartBody as bvh_helper import numpy as np class SmartBodySkeleton(object): def __init__(self): # 定义bvh 节点名,和npy 对应idx # self.root = 'Hips' self.root = 'Pelvis' self.keypoint2index = { 'Pelvis': 0, 'Left_hip': 1, 'Right_hip':2, 'Spine1': 3, 'Left_knee': 4, 'Right_knee': 5, 'Spine2': 6, 'Left_ankle': 7, 'Right_ankle': 8, 'Spine3': 9, 'Left_foot': 10, 'Right_foot': 11, 'Neck': 12, 'Left_collar':13, 'Right_collar': 14, 'Head': 15, 'Left_shoulder': 16, 'Right_shoulder': 17, 'Left_elbow': 18, 'Right_elbow': 19, 'Left_wrist': 20, 'Right_wrist': 21, 'Left_palm': 22, 'Right_palm': 23, 'EndSite': -1, } # self.keypoint2index = { # 'Hips': 0, # 'LeftHipJoint': -1, # 'RightHipJoint':-1, # 'LowerBack': 3, # 'LeftUpLeg': 1, # 'RightUpLeg': 2, # 'Spine': 6, # 'LeftLeg': 4, # 'RightLeg': 5, # 'Spine1': 9, # 'LeftFoot': 7, # 'RightFoot': 8, # 'Neck': 12, # 'LeftShoulder':-1, # 'RightShoulder': -1, # 'Neck1': 15, # 'LeftArm': 16, # 'RightArm': 17, # 'LeftForeArm': 18, # 'RightForeArm': 19, # 'LeftHand': 20, # 'RightHand': 21, # 'LeftHandEndSite': -1, # 'RightHandEndSite': -1, # 'LeftFootEndSite': -1, # 'RightFootEndSite': -1, # 'HeadEndSite': -1, # } self.index2keypoint = {v: k for k, v in self.keypoint2index.items()} self.keypoint_num = len(self.keypoint2index) # 定义 bvh 节点关系 self.children = { 'Pelvis': ['Left_hip','Right_hip','Spine1'], 'Left_hip': ['Left_knee'], 'Left_knee': ['Left_ankle'], 'Left_ankle': ['Left_foot'], 'Left_foot': ['EndSite'], 'EndSite': [], 'Right_hip': ['Right_knee'], 'Right_knee': ['Right_ankle'], 'Right_ankle': ['Right_foot'], 'Right_foot': ['EndSite'], 'Spine1': ['Spine2'], 'Spine2': ['Spine3'], 'Spine3': ['Neck','Left_collar','Right_collar'], 'Neck': ['Head'], 'Head': ['EndSite'], 'Left_collar': ['Left_shoulder'], 'Left_shoulder': ['Left_elbow'], 'Left_elbow': ['Left_wrist'], 'Left_wrist': ['Left_palm'], 'Left_palm': ['EndSite'], 'Right_collar': ['Right_shoulder'], 'Right_shoulder': ['Right_elbow'], 'Right_elbow': ['Right_wrist'], 'Right_wrist': ['Right_palm'], 'Right_palm': ['EndSite'], } # self.children = { # 'Hips': ['LeftHipJoint', 'LowerBack', 'RightHipJoint'], # 'LeftHipJoint': ['LeftUpLeg'], # 'LeftUpLeg': ['LeftLeg'], # 'LeftLeg': ['LeftFoot'], # 'LeftFoot': ['LeftFootEndSite'], # 'LeftFootEndSite': [], # 'LowerBack': ['Spine'], # 'Spine': ['Spine1'], # 'Spine1': ['LeftShoulder', 'Neck', 'RightShoulder'], # 'LeftShoulder': ['LeftArm'], # 'LeftArm': ['LeftForeArm'], # 'LeftForeArm': ['LeftHand'], # 'LeftHand': ['LeftHandEndSite'], # 'LeftHandEndSite': [], # 'Neck': ['Neck1'], # 'Neck1': ['HeadEndSite'], # 'HeadEndSite': [], # 'RightShoulder': ['RightArm'], # 'RightArm': ['RightForeArm'], # 'RightForeArm': ['RightHand'], # 'RightHand': ['RightHandEndSite'], # 'RightHandEndSite': [], # 'RightHipJoint': ['RightUpLeg'], # 'RightUpLeg': ['RightLeg'], # 'RightLeg': ['RightFoot'], # 'RightFoot': ['RightFootEndSite'], # 'RightFootEndSite': [], # } self.parent = {self.root: None} for parent, children in self.children.items(): for child in children: self.parent[child] = parent self.left_joints = [ joint for joint in self.keypoint2index if 'Left' in joint ] self.right_joints = [ joint for joint in self.keypoint2index if 'Right' in joint ] # # self.initial_directions = { # 'Hips': [0, 0, 0], # 'LeftUpLeg': [1, -0.5, 0], # 'LeftLeg': [0, -1, 0], # 'LeftFoot': [0, -1, 0], # 'LeftFootEndSite': [0, 0, 1], # 'LowerBack': [0, 1, 0], # 'Spine': [0, 1, 0], # 'Spine1': [0, 1, 0], # 'RightShoulder': [-1, 0, 0], # 'LeftShoulder': [1, 0, 0], # 'LeftArm': [1, 0.5, 0], # 'LeftHand': [1, 0, 0], # 'LeftHandEndSite': [1, 0, 0], # 'Neck': [0, 1, 0], # 'Neck1': [0, 1, 0], # 'HeadEndSite': [0, 1, 0], # 'RightArm': [-1, 0.5, 0], # 'RightHand': [-1, 0, 0], # 'RightHandEndSite': [-1, 0, 0], # 'RightUpLeg': [-1, -0.5, 0], # 'RightLeg': [0, -1, 0], # 'RightFoot': [0, -1, 0], # 'RightFootEndSite': [0, 0, 1], # 'LeftForeArm': [1, 0, 0], # 'RightForeArm': [-1, 0, 0], # 'RightHipJoint': [-1, 0, 0], # 'LeftHipJoint': [1, 0, 0], # } # SmartBody坐标系(Y向上,Z向前,X向右)下的T-pose,定义节点方向 self.initial_directions = { 'Pelvis': [0, 0, 0], 'Left_hip': [1, -0.9, 0], 'Right_hip': [-1, -0.9, 0], 'Spine1': [0, 1, 0], 'Left_knee': [0, -1, 0], 'Right_knee': [0, -1, 0], 'Spine2': [0, 1, 0], 'Left_ankle': [0, -1, 0], 'Right_ankle': [0, -1, 0], 'Spine3': [0, 1, 0], 'Left_foot': [0, -0.5, 1], 'Right_foot': [0, -0.5, 1], 'Neck': [0, 1, 0], 'Left_collar': [1, 0.9, 0], 'Right_collar': [-1, 0.9, 0], 'Head': [0, 1, 0], 'Left_shoulder': [1, 0, 0], 'Right_shoulder': [-1, 0, 0], 'Left_elbow': [1, 0, 0], 'Right_elbow': [-1, 0, 0], 'Left_wrist': [1, 0, 0], 'Right_wrist': [-1, 0, 0], 'Left_palm': [1, 0, 0], 'Right_palm': [-1, 0, 0], 'EndSite': [0, 0, 1], } def get_initial_offset(self, poses_3d): # TODO: RANSAC # 计算父节点-子节点 欧氏距离 bone_lens = {self.root: [0]} stack = [self.root] while stack: parent = stack.pop() p_idx = self.keypoint2index[parent] p_name = parent while p_idx == -1: # find real parent p_name = self.parent[p_name] p_idx = self.keypoint2index[p_name] for child in self.children[parent]: stack.append(child) if self.keypoint2index[child] == -1: bone_lens[child] = [0.1] else: c_idx = self.keypoint2index[child] bone_lens[child] = np.linalg.norm( poses_3d[:, p_idx] - poses_3d[:, c_idx], axis=1 ) # 吧所有动作 取平均距离、左右距离相同 bone_len = {} for joint in self.keypoint2index

资源文件列表:

npy2bvh.zip 大约有26个文件
  1. npy2bvh/__init__.py
  2. npy2bvh/__pycache__/
  3. npy2bvh/__pycache__/__init__.cpython-310.pyc 139B
  4. npy2bvh/bvh_skeleton/
  5. npy2bvh/bvh_skeleton/__init__.py 65B
  6. npy2bvh/bvh_skeleton/__pycache__/
  7. npy2bvh/bvh_skeleton/__pycache__/__init__.cpython-310.pyc 235B
  8. npy2bvh/bvh_skeleton/__pycache__/bvh_helper.cpython-310.pyc 2.54KB
  9. npy2bvh/bvh_skeleton/__pycache__/bvh_helper_SmartBody.cpython-310.pyc 2.52KB
  10. npy2bvh/bvh_skeleton/__pycache__/h36m_original_skeleton.cpython-310.pyc 2.35KB
  11. npy2bvh/bvh_skeleton/__pycache__/h36m_skeleton.cpython-310.pyc 5.77KB
  12. npy2bvh/bvh_skeleton/__pycache__/math3d.cpython-310.pyc 3.95KB
  13. npy2bvh/bvh_skeleton/__pycache__/math3d_SmartBody.cpython-310.pyc 4.43KB
  14. npy2bvh/bvh_skeleton/__pycache__/smartbody_skeleton.cpython-310.pyc 6.64KB
  15. npy2bvh/bvh_skeleton/bvh_helper.py 2.28KB
  16. npy2bvh/bvh_skeleton/bvh_helper_SmartBody.py 2.23KB
  17. npy2bvh/bvh_skeleton/cmu_skeleton.py 10.18KB
  18. npy2bvh/bvh_skeleton/coco_skeleton.py 1.7KB
  19. npy2bvh/bvh_skeleton/h36m_original_skeleton.py 3.06KB
  20. npy2bvh/bvh_skeleton/h36m_skeleton.py 9.35KB
  21. npy2bvh/bvh_skeleton/math3d.py 5.08KB
  22. npy2bvh/bvh_skeleton/math3d_SmartBody.py 4.65KB
  23. npy2bvh/bvh_skeleton/openpose_skeleton.py 1.9KB
  24. npy2bvh/bvh_skeleton/smartbody_skeleton.py 15KB
  25. npy2bvh/bvh_skeleton/smartbody_skeleton_simplify.py 10.37KB
  26. npy2bvh/npy2bvh.py 1.36KB
0评论
提交 加载更多评论
其他资源 Git常用命令参考手册,涵盖了在开发中用到的git
Git常用命令参考手册 基本涵盖了在开发中用到的git命令,能满足日常需求 通俗易懂的例子,30分钟快速入门
Git常用命令参考手册,涵盖了在开发中用到的git Git常用命令参考手册,涵盖了在开发中用到的git Git常用命令参考手册,涵盖了在开发中用到的git
.net6.0-8.0 Swagger 免费源码
.net6.0_8.0 Swagger 免费源码 相关文章:https://blog.csdn.net/djk8888/article/details/141170197
0x00000709一键修复
0x00000709一键修复
pip whl文件以及pycryptodomex whl文件
pip whl文件以及pycryptodomex whl文件
图书管理系统(图书录入和管理,借阅管理,图书管理)
在图书管理系统中,通常会包括以下功能和模块: 图书录入和管理:包括添加、修改和删除图书信息,包括编号、书名、作者、出版社、出版日期、价格、数量等。 借阅管理:记录读者借阅的图书信息,包括借阅日期、归还日期等。 图书管理:登陆注册,查看当前书籍信息,如图书编号、图书名称、出版社、出版日期、图书作者、价格、数量(修改)、操作(删除、借阅)
ibetameios14_xz7.com.zip
ibetameios14_xz7.com.zip
123HK.KJ;LKLB.JLK;/
JHLKJ;LJ;LHJKBHLKL;JLHJ
qt 输出一条正弦波,自己学习使用
qt 输出一条正弦波,自己学习使用