无法将3d层文件图像转换为2d图像 [英] Unable to convert 3d ply file image to 2d image

查看:144
本文介绍了无法将3d层文件图像转换为2d图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这时我真的很困,想将3d面部图像转换为2d图像以将深度标签粘贴到我的FCN.

我已经通过此链接生成了3dmm模型的人脸图像.

I am really stuck at this point and want to convert my 3d face image to 2d image for depth label to my FCN.

I have gone through this link to generate my 3dmm model face image.

https://github.com/Yinghao-Li/3DMM-fitting

Any help will really get me through. Thanks in advance.

解决方案

You could try something like pyrender.

For documentation purposes here's one of their example:

import numpy as np
import trimesh
import pyrender
import matplotlib.pyplot as plt
fuze_trimesh = trimesh.load('examples/models/fuze.obj')
mesh = pyrender.Mesh.from_trimesh(fuze_trimesh)
scene = pyrender.Scene()
scene.add(mesh)
camera = pyrender.PerspectiveCamera(yfov=np.pi / 3.0, aspectRatio=1.0)
s = np.sqrt(2)/2
camera_pose = np.array([
   [0.0, -s,   s,   0.3],
   [1.0,  0.0, 0.0, 0.0],
   [0.0,  s,   s,   0.35],
   [0.0,  0.0, 0.0, 1.0],
])
scene.add(camera, pose=camera_pose)
light = pyrender.SpotLight(color=np.ones(3), intensity=3.0,
                           innerConeAngle=np.pi/16.0,
                           outerConeAngle=np.pi/6.0)
scene.add(light, pose=camera_pose)
r = pyrender.OffscreenRenderer(400, 400)
color, depth = r.render(scene)
plt.figure()
plt.subplot(1,2,1)
plt.axis('off')
plt.imshow(color)
plt.subplot(1,2,2)
plt.axis('off')
plt.imshow(depth, cmap=plt.cm.gray_r)
plt.show()

or Open3D.

Again, one of the library supplied examples:

pcd = o3d.io.read_point_cloud("../../TestData/fragment.ply")
o3d.visualization.draw_geometries([pcd], zoom=0.3412,
                                  front=[0.4257, -0.2125, -0.8795],
                                  lookat=[2.6172, 2.0475, 1.532],
                                  up=[-0.0694, -0.9768, 0.2024])

这篇关于无法将3d层文件图像转换为2d图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆