'How to plot 3D bounding boxes on Point Cloud Data(PCD) files for visualization?

I have centroid(xyz), dimensions(l,h,w) and rotation angle. PCD may contain many objects but I want to draw in a particular object



Solution 1:[1]

If you don't want to use libraries, all you have to do is to draw 6 rectangles in 3 different planes (actually 4 rectangles is enough).

Solution 2:[2]

import open3d as o3d
import numpy as np


# Load data
demo_crop_data = o3d.data.DemoCropPointCloud()
pcd = o3d.io.read_point_cloud(demo_crop_data.point_cloud_path)

center = np.array([0, 0, 0])
r = np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]])
size = np.array([10, 10, 10])
sample_3d = o3d.geometry.OrientedBoundingBox(center, r, size)

o3d.visualization.draw_geometries([pcd, sample_3d],
                                  zoom=0.7,
                                  front=[0.5439, -0.2333, -0.8060],
                                  lookat=[2.4615, 2.1331, 1.338],
                                  up=[-0.1781, -0.9708, 0.1608])

you can use open3d to draw it and visualize it.

open3d OrientedBoundingBox

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Victoria Kepler
Solution 2 Zhengfang Xin