You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

26 lines
593 B

'''
获取Mesh的深度图
required:
- open3d
- numpy
'''
import open3d as o3d
import numpy as np
def get_depth(w2c: np.ndarray, intrinsic: o3d.camera.PinholeCameraIntrinsic, render: o3d.visualization.rendering.OffscreenRenderer) -> o3d.geometry.Image:
'''
获取rgbd图像
param:
mesh: 需要渲染的mesh
w2c: 世界坐标系到相机坐标系的变换矩阵
K: 相机内参
render: 渲染器
'''
render.setup_camera(intrinsic, w2c)
depth = render.render_to_depth_image(z_in_view_space=True)
return np.asarray(depth)