Skip to content

Minimal example O3DVisualizer with KITTI data #7063

Open
@Petros626

Description

Checklist

My Question

Hello,

I got the problem to visualize a normal point cloud with gt labels. I got the order of O3DVisualizer initialisation from one of the examples here.

def draw_demo_scenesO3D(points, gt_boxes=None, ref_boxes=None, ref_labels=None, ref_scores=None, point_colors=None, draw_origin=True, vc=None):
    if isinstance(points, torch.Tensor):
        points = points.cpu().numpy()
    if isinstance(gt_boxes, torch.Tensor):
        gt_boxes = gt_boxes.cpu().numpy()
    if isinstance(ref_boxes, torch.Tensor):
        ref_boxes = ref_boxes.cpu().numpy()

    app = open3d.visualization.gui.Application.instance
    app.initialize()
    vis = open3d.visualization.O3DVisualizer('Open3D - O3DVisualizer', 640, 480)
    vis.show_settings = True
   
    vis.point_size = 1
    vis.set_background((0, 0, 0, 1), None) # RGBA

    # draw origin (x = Forward, y = Left ,z = Upward)
    if draw_origin:
        axis_pcd = open3d.geometry.TriangleMesh.create_coordinate_frame(size=1.0, origin=[0, 0, 0])
        vis.add_geometry("Axis", axis_pcd)

    pts = open3d.geometry.PointCloud()
    pts.points = open3d.utility.Vector3dVector(points[:, :3]) # x, y, z
    vis.add_geometry("Points", pts)

    if point_colors is None:
        pts.colors = open3d.utility.Vector3dVector(np.ones((points.shape[0], 3)))
    else:
        pts.colors = open3d.utility.Vector3dVector(point_colors)

    if gt_boxes is not None:
        vis = draw_demo_boxO3D(vis, gt_boxes, keypoint_color=(0, 0, 1)) 

    app.add_window(vis)
    app.run()
    vis.close()

    return vis

image

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions