问题描述
我在 Open3D 中找到了几个关于从 RGB-D 图像可视化点云的教程.但我只在灰度模式下得到结果.这是我的示例代码:
I found several tutorials about visualization of point cloud from RGB-D image in Open3D. But I only got the result in gray-scale mode. Here is my example code:
import open3d as o3d # installed by running: <pip install open3d-python>
def img_to_pointcloud(img, depth, K, Rt):
rgb = o3d.geometry.Image(img)
depth = o3d.geometry.Image(depth)
rgbd = o3d.geometry.create_rgbd_image_from_color_and_depth(rgb, depth, depth_scale=1.0, depth_trunc=50.0)
fx, fy, cx, cy = K[0, 0], K[1, 1], K[0, 2], K[1, 2]
intrinsic = o3d.camera.PinholeCameraIntrinsic(int(cx*2), int(cy*2), fx, fy, cx, cy)
pc = o3d.create_point_cloud_from_rgbd_image(rgbd, intrinsic, Rt)
o3d.visualization.draw_geometries([pc])
结果示例可以在 http://www.open3d.org/docs/release/getting_started.html#running-open3d-tutorials" rel="nofollow noreferrer">http://www.open3d.org/docs/release/getting_started.html#running-open3d-tutorials.Open3D 是否支持在 RGB 模式下可视化点云.如果没有,您会推荐 Python 中的哪些库?
The example of result can be found at http://www.open3d.org/docs/release/getting_started.html#running-open3d-tutorials. Does Open3D support visualize point cloud in RGB mode. If it doesn't, what the library would you recommend in Python?
推荐答案
是的,确实如此.
Open3D.geometry.create_rgbd_image_from_color_and_depth
有一个可选参数 convert_rgb_to_intensity
,默认设置为 true.
Open3D.geometry.create_rgbd_image_from_color_and_depth
has an optional parameter convert_rgb_to_intensity
which is set to be true by default.
要在 RGB 模式下可视化,只需将第五行更改为rgbd = o3d.geometry.create_rgbd_image_from_color_and_depth(rgb, depth, depth_scale=1.0, depth_trunc=50.0, convert_rgb_to_intensity=False)
.
To visualize in RGB mode, just change your fifth line torgbd = o3d.geometry.create_rgbd_image_from_color_and_depth(rgb, depth, depth_scale=1.0, depth_trunc=50.0, convert_rgb_to_intensity=False)
.
这篇关于Open3d 可以在 RGB 模式下可视化点云吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!