资讯 小学 初中 高中 语言 会计职称 学历提升 法考 计算机考试 医护考试 建工考试 教育百科
栏目分类:
子分类:
返回
空麓网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
空麓网 > 计算机考试 > 软件开发 > 后端开发 > Python

mmhuman3d安装及读取.smc文件

Python 更新时间: 发布时间: 计算机考试归档 最新发布

mmhuman3d安装及读取.smc文件

mmhuman3d安装及读取.smc文件

mmhuman3d下载安装

为了防止冲突以及保持项目的独立性,直接将所有package都搞到本地文件夹下,不装到dist-packages下面

mmhuman3d

git clone https://github.com/open-mmlab/mmhuman3d.git
cd mmhuman3d
python setup.py build_ext --inplace

mmcv

wget https://files.pythonhosted.org/packages/bc/8d/19cad8c32db1ed832ea49026eb6a1fd9d6255d6f856a87ea2828a1555905/mmcv-1.7.0.tar.gz
tar -zxvf mmcv-1.7.0.tar.gz
cd mmcv-1.7.0
python setup.py build_ext --inplace
cp -r mmcv …/

einops

cd mmhuman3d
wget https://files.pythonhosted.org/packages/12/59/4fea1764008e4cfa5f7cae68e07b882e972d5c0bb6479139075cb1123e19/einops-0.4.0.tar.gz
tar -zxvf einops-0.4.0.tar.gz
cd ein*/
python setup.py build_ext --inplace
cp -r einops …

下载文件

需要下载的数据集在这里
下载解压以后,用如下代码测试结果:

import syssys.path.append('/your/path/to/mmhuman3d') # setup以后会生成一个mmhuman3d的文件夹from mmhuman3d.data.data_structures.smc_reader import SMCReader# Initialize a smc readersmc_reader = SMCReader('/your/path/to/xxx.smc')# Get calibration# Kinect IDs: from 0 to 9# iPhone ID: 0; vertical: images are transformed from landscape to vertical# 4x4 matrixkinect_extrinsics = smc_reader.get_kinect_color_extrinsics(kinect_id=0)iphone_extrinsics = smc_reader.get_iphone_extrinsics(iphone_id=0)# Get images# frame_num * height * width * 3kinect_images = smc_reader.get_color(device='Kinect', device_id=0) # n * 1080 * 1920 * 3iphone_images = smc_reader.get_color(device='iPhone', device_id=0, vertical=True) # n * 1920 * 1440 * 3# Get depth maps# frame_num * height * widthkinect_depth = smc_reader.get_kinect_depth(kinect_id=0) # n * 576 * 640iphone_depth = smc_reader.get_iphone_depth(iphone_id=0) # n * 256 * 192# Get 2D keypoints# frame_num * keypoint_num * 3  (x, y, confidence)kinect_keypoints2d, kinect_keypoints2d_mask = smc_reader.get_keypoints2d(device='Kinect', device_id=0)iphone_keypoints2d, iphone_keypoints2d_mask = smc_reader.get_keypoints2d(device='iPhone', device_id=0, vertical=True)# Get 3D keypoints# frame_num * keypoint_num * 4  (x, y, z, confidence)keypoints3d, keypoints3d_mask = smc_reader.get_keypoints3d(device='Kinect', device_id=0)

注意,图片是BGR格式的,想要改成RGB可以用

kinect_images = smc_reader.get_color(device='Kinect', device_id=0)[..., ::-1]

如果想要预览这个数据集的视频,可以用如下函数保存成mp4:

def numpy_array_to_video(numpy_array,video_out_path):	# 将BGR转换为RGB    numpy_array = numpy_array[..., ::-1]    video_height = numpy_array.shape[1]    video_width = numpy_array.shape[2]    out_video_size = (video_width,video_height)    output_video_fourcc = int(cv2.VideoWriter_fourcc(*'mp4v'))    video_write_capture = cv2.VideoWriter(video_out_path, output_video_fourcc, 30, out_video_size)    for frame in numpy_array:        video_write_capture.write(frame)    video_write_capture.release()

例如:

numpy_array_to_video(kinect_images,'1_out.mp4')

深度相机

一共有0-9共10个深度相机,device_id从小到大依次为:
0: 前
1: 右前
2: 右上
3: 右下
4: 右后
5: 后
6: 左后
7: 左上
8: 左下
9: 左前
其中共8个方位角,左右两侧各两个深度相机,位于上/下。其余位置1个深度相机。

本人正在研究smplx相关替代方案。如果您对此方面感兴趣,可以和我联系。

转载请注明:文章转载自 http://www.konglu.com/
本文地址:http://www.konglu.com/it/1097025.html
免责声明:

我们致力于保护作者版权,注重分享,被刊用文章【mmhuman3d安装及读取.smc文件】因无法核实真实出处,未能及时与作者取得联系,或有版权异议的,请联系管理员,我们会立即处理,本文部分文字与图片资源来自于网络,转载此文是出于传递更多信息之目的,若有来源标注错误或侵犯了您的合法权益,请立即通知我们,情况属实,我们会第一时间予以删除,并同时向您表示歉意,谢谢!

我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2023 成都空麓科技有限公司

ICP备案号:蜀ICP备2023000828号-2