Search code examples
pythonpoint-cloud-libraryopen3d

Can Open3d visualize a point cloud in RGB mode?


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])

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?


Solution

  • Does Open3D support visualize point cloud in RGB mode?

    Yes, it does.

    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.

    To visualize in RGB mode, just change your fifth line to
    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).