bvh格式转换

目录

bvh格式介绍

3d点转bvh

npz格式:

bvh格式转换:

bvh-converter ok

BVH_reader和bvh-converter 一致

生成bvh:

导入导出bvh

bvh可视化:

H3.6M数据集转bvh

csv转bvh

pkl转换bvh


bvh格式介绍

[转载] BVH文件格式解析 - 知乎

3d点转bvh

https://github.com/Garfield-kh/PoseTriplet/blob/eb93132f99161bd776dafbcb713e9fb43e501c36/estimator/pose2bvh_debug.py

npz格式:

这个可能是标准的:

https://github.com/HW140701/VideoTo3dPoseAndBvh/blob/bb06a001a91482b6ece76b9cb672dd50b6e4dd3a/bvh_skeleton/smartbody_skeleton.py

保存:

 np.savez_compressed(output_npz, reconstruction=output_3d_all)

读取:

    prediction = np.load(r'D:\data\output_keypoints_3d.npz', allow_pickle=True)

    for key in prediction.keys():
        prediction = prediction[key]

    prediction = prediction.astype('float32')

bvh格式转换:

https://github.com/Garfield-kh/PoseTriplet/blob/eb93132f99161bd776dafbcb713e9fb43e501c36/estimator/bvh_skeleton/bvh_helper.py

bvh-converter ok

pip install bvh-converter

bvh-converter 文件名

or:python -m bvh-converter 文件名

BVH_reader和bvh-converter 一致

https://github.com/ColbyZhuang/BVH_reader

生成bvh:

https://github.com/non-void/LocalMoCap

导入导出bvh

https://github.com/Bforartists/Bforartists/tree/3d94e92f18be68df89386106dabe761f4f12b336/scripts/addons/io_anim_bvh

bvh可视化:

https://github.com/dabeschte/npybvh/blob/master/bvh.py

H3.6M数据集转bvh

https://github.com/DK-Jang/human_motion_manifold/blob/dd3b603b892d66685204909c8818f3e1621ab7dc/dataset/make_H3.6M_bvh.py

csv转bvh

https://github.com/Dene33/hmr/blob/83b2c33d42b87781a361c5f01f6fd51afb8517d4/csv_to_bvh.py

import csv
import os
import bpy

objects = bpy.context.scene.objects

empties = []

for object in objects:
    if object.type == 'EMPTY':
        empties.append(object)
        
print(empties)

filename = 'csv_joined.csv'
directory = r'hmr/output/csv_joined'  # <-- if you have linux or osx

fullpath = os.path.join(directory, filename)

with open(fullpath, 'r', newline='') as csvfile:
    ofile = csv.reader(csvfile, delimiter=',')
    next(ofile) # <-- skip the x,y,z header

    for line in ofile:
        f, *pts = line

        # these things are still strings (that's how they get stored in the file)
        # here we recast them to integer and floats
        frame_num = int(f)
        fpts = [float(p) for p in pts]
        coordinates = [fpts[0:3], fpts[3:6], fpts[6:9], fpts[9:12],
                       fpts[12:15], fpts[15:18], fpts[18:21], fpts[21:24],
                       fpts[24:27], fpts[27:30], fpts[30:33], fpts[33:36],
                       fpts[36:39], fpts[39:42],fpts[42:45], fpts[45:48],
                       fpts[48:51], fpts[51:54], fpts[54:57], fpts[57:60]]
                       

        bpy.context.scene.frame_set(frame_num)
        bpy.data.scenes['Scene'].frame_end = frame_num + 1
        
        for ob, position in zip(empties, coordinates):
            ob.location = position
            ob.keyframe_insert(data_path="location", index=-1)

bpy.data.objects['rig'].select = True

target_file = 'hmr/output/bvh_animation/estimated_animation.bvh'

bpy.ops.export_anim.bvh(filepath=target_file)

pkl转换bvh

【姿态识别】PoseTriplet——3D转bvh-CSDN博客

代码地址:
https://github.com/Garfield-kh/PoseTriplet/blob/eb93132f99161bd776dafbcb713e9fb43e501c36/estimator/posegan_evaluate.py#L360

运行posegan_evaluate.py

环境安装
sklearn

pip install scikit-learn
pip install torchgeometry
問題解決
No such file or directory: ‘data/data_3d_h36m.npz’
下载地址:https://download.csdn.net/download/weixin_46870724/88584488

FileNotFoundError: [Errno 2] No such file or directory:
‘data/data_2d_h36m_gt.npz’
下载地址:https://download.csdn.net/download/weixin_46870724/88584804

FileNotFoundError: [Errno 2] No such file or directory: './data_cross/3dhp/3dhp_testset_bySub.pkl'
下载地址:https://download.csdn.net/download/weixin_46870724/88585024?spm=1001.2014.3001.5503

運行
运行pose2bvh_debug.py
代码中配置好生成3D的pkl文件即可

原文链接:https://blog.csdn.net/weixin_46870724/article/details/134719737

### 回答1: 可以使用软件工具进行BVH格式到BIP格式的转换。例如使用Autodesk Maya软件中的"Import BVH"功能导入BVH文件,然后使用"Export Selected"功能导出为BIP格式。也可以使用其他专业的骨骼动画转换软件如Houdini, MotionBuilder等。 ### 回答2: BVH是一种常用的动作捕捉数据格式,而BIP是一种专门用于3D动画软件的骨骼动画格式。因此,要将BVH格式转换为BIP格式,需要进行以下步骤: 1.准备工作:首先需要准备一个3D动画软件,例如Autodesk 3ds Max或者MotionBuilder。这些软件都支持BIP格式的导入和导出。 2.导入BVH文件:使用所选的3D动画软件,导入BVH格式的文件。在导入过程中,软件会将BVH文件中的层次结构和动作数据转换为相应的骨骼和动画轨迹。 3.调整骨骼:确认BVH文件成功导入后,可能需要对骨骼进行调整,以适应目标BIP格式。这可能涉及到对骨骼名称、层级结构或者骨骼的旋转角度进行修改。 4.调整关键帧:由于BVH和BIP格式之间的差异,需要对动画数据进行调整,使其适应BIP格式的要求。这包括消除非法动作或关键帧,并确保动作流畅地在BIP格式的骨骼上播放。 5.导出BIP文件:完成上述调整后,通过选择导出选项,将骨骼以BIP格式导出为新的文件。在导出过程中,选择适当的选项来确保输出文件符合BIP格式规范。 总结起来,将BVH格式转换为BIP格式需要导入BVH文件、调整骨骼和关键帧,并最终将其导出为BIP格式的文件。这样可以使BVH格式的动作数据能够在BIP格式的骨骼动画软件中使用。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

AI算法网奇

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值