Search code examples
pythonpoint-cloud-librarypoint-cloudsopen3d

Visualize Point Cloud with Open3d with XYZRGB Values (Python)


I have a 2 arrays- one with XYZ coordinates and one with RBG values. Both are n x 3 shown below. When I try the code below to visualize the geometry with the respective RGB values, I get the error in Python. How can I visualize the points with their respective colors with Open3d? Many thanks!:

Inputs: 'mypoints' array of n x 3, and 'colors_dbscan' array of n x 3.

enter image description here enter image description here

Code attempted:

import open3d as o3d
o3d.visualization.draw_geometries([mypoints, colors_dbscan], window_name='DBSCAN')

Error:

    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-3-bca02a8c2eb2>", line 1, in <module>
    o3d.visualization.draw_geometries(pc)
TypeError: draw_geometries(): incompatible function arguments. The following argument types are supported:
    1. (geometry_list: List[open3d.cpu.pybind.geometry.Geometry], window_name: str = 'Open3D', width: int = 1920, height: int = 1080, left: int = 50, top: int = 50, point_show_normal: bool = False, mesh_show_wireframe: bool = False, mesh_show_back_face: bool = False) -> None
    2. (geometry_list: List[open3d.cpu.pybind.geometry.Geometry], window_name: str = 'Open3D', width: int = 1920, height: int = 1080, left: int = 50, top: int = 50, point_show_normal: bool = False, mesh_show_wireframe: bool = False, mesh_show_back_face: bool = False, lookat: numpy.ndarray[float64[3, 1]], up: numpy.ndarray[float64[3, 1]], front: numpy.ndarray[float64[3, 1]], zoom: float) -> None
Invoked with: <__main__.PointCloudAnalysis object at 0x0000022A5C683A48>

Solution

  • You need to first convert array of points to point cloud format.

    And than assign color to point cloud.

    This issue is what you need.