python - 从深度图像生成点云

标签 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

最佳答案

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

安装后:

import open3d as o3d

rgbd = o3d.geometry.RGBDImage.create_from_color_and_depth(color, depth, convert_rgb_to_intensity = False)
pcd = o3d.geometry.PointCloud.create_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,深度图像为深度,请查看open3d附带的示例以获取更多信息.

如果您有自己的相机内在功能,则可以用它们替换pinhole_camera_intrinsic,但对于测试运行,针孔相机或多或少可以正常工作。

关于python - 从深度图像生成点云,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59590200/

相关文章:

c++ - 以 x y z r g b 格式读取 ascii 点云

boost - 如何读取/转换 stanford bunny .ply-files 的范围图像?

python - xml.dom.minidom 通过标记名获取元素

python - bool 表达式中的正则表达式

ios - 在 iOS 应用程序中为形状着色

html - CSS 背景图像很奇怪很奇怪我只是无法得到它

python - Z3PY 将 Int 转换为 Python int

python - Apache Airflow - 即使关键任务失败,DAG 也会注册为成功

r - 提高 R 光线着色器图像的分辨率

python - 使用 cKDTree 在一定距离内寻找最近的邻居并取这些邻居的平均值