【问题标题】:Unable to convert 3d ply file image to 2d image无法将 3d ply 文件图像转换为 2d 图像
【发布时间】:2020-11-24 21:06:14
【问题描述】:

我真的被困在这一点上,想将我的 3d 人脸图像转换为 2d 图像,以便为我的 FCN 提供深度标签。

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

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

任何帮助都会帮助我度过难关。 提前致谢。

【问题讨论】:

    标签: python image-processing neural-network conv-neural-network depth-buffer


    【解决方案1】:

    你可以试试pyrender

    出于文档目的,这是他们的示例之一:

    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()
    

    Open3D

    再次,库提供的示例之一:

    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])
    

    【讨论】:

      猜你喜欢
      • 2018-03-24
      • 1970-01-01
      • 2012-12-03
      • 1970-01-01
      • 1970-01-01
      • 2013-06-16
      • 1970-01-01
      • 2021-07-14
      • 1970-01-01
      相关资源
      最近更新 更多