我有一个2D numpy阵列(640x480),它包含了我通过渲染系统获得的每个像素的深度值。现在我要获得它的点云。我尝试了很多方法,但我对轮换有问题:
方法我试过:
color_raw = o3d.io.read_image("../../test_data/RGBD/color/00000.jpg")
depth_raw = o3d.io.read_image("../../test_data/RGBD/depth/00000.png")
rgbd_image = o3d.geometry.RGBDImage.create_from_color_and_depth(
color_raw, depth_raw)
a = o3d.camera.PinholeCameraIntrinsicParameters
pcd = o3d.geometry.PointCloud.create_from_rgbd_image(
rgbd_image,
o3d.camera.PinholeCameraIntrinsic(
o3d.camera.PinholeCameraIntrinsicParameters.Kinect2DepthCameraDefault))
o3d.visualization.draw_geometries([pcd])
问题:
( a)我没有rgbd图像。我所拥有的只是一个包含每个像素深度值的2d numpy数组,它可以保存为png图像并用于参数depth_raw。
( b)我试图仅使用函数open3d.geometry.PointCloud.create_from_depth_image(depth, intrinsic, extrinsic=(with default value), depth_scale=1000.0, depth_trunc=1000.0, stride=1, project_valid_depth_only=True)
从深度图像创建点云,但是当我试图传递png图像时会出现错误。如何将numpy数组传递到所需的图像格式。
请帮助我将上述疑问继续下去。
提前感谢
发布于 2022-04-08 22:07:17
尝试如下:深度必须是n,n numpy数组,然后
import open3d as o3d
vertices = []
depths = (your_depth_values)
for x in range(depths.shape[0]):
for y in range(depths.shape[1]):
vertices.append((float(x), float(y), depths[x][y]))
pcd = o3d.geometry.PointCloud()
point_cloud = np.asarray(np.array(vertices))
pcd.points = o3d.utility.Vector3dVector(point_cloud)
pcd.estimate_normals()
pcd = pcd.normalize_normals()
o3d.visualization.draw_geometries([pcd])
https://stackoverflow.com/questions/67606927
复制相似问题