从深度图像生成点云

时间:2020-01-04 11:23:24

标签: python image point-clouds depth projection-matrix

我正在尝试将深度图像(RGBD)转换为3d点云。我当前使用的解决方案取自this post,其中:

  • cx =图像中心高度
  • cy =图像中心宽度
  • 通过重复几个选项选择的
  • fxfy = 250

深度测量是从针孔相机进行的,并且点云正从中心凸出(以下示例图像)。谁能帮助我了解为什么以及如何解决这个问题?

enter image description here enter image description here enter image description here

1 个答案:

答案 0 :(得分:6)

您可以使用open3d软件包轻松解决此问题。使用sudo pip install -U open3d-python(不仅仅是open3d -这是另一个软件包)安装它。

一旦安装:

from open3d import *

rgbd = create_rgbd_image_from_color_and_depth(color, depth, convert_rgb_to_intensity = False)
pcd = create_point_cloud_from_rgbd_image(rgbd, pinhole_camera_intrinsic)

# flip the orientation, so it looks upright, not upside-down
pcd.transform([[1,0,0,0],[0,-1,0,0],[0,0,-1,0],[0,0,0,1]])

draw_geometries([pcd])    # visualize the point cloud

以上代码假设您在color中有彩色图像,在depth中有深度图像,请检查open3d附带的样本以获取更多信息。

如果您有自己的相机固有功能,则可以用这些相机代替pinhole_camera_intrinsic,但是对于试运行而言,针孔相机或多或少可以正常工作。

相关问题