simple-waymo-open-dataset-reader
simple-waymo-open-dataset-reader copied to clipboard
plotting 3D boxes on the point cloud
Hi, I wish to do this: range image -> pcl -> plot 3D boxes from the labels in the PCL
How can I do that? Please help.
I tried the following code but I don't understand the result.
`# get the 3D box coordinates for the point cloud - each frame will have many objects and as many labels for label in frame.laser_labels:
# compute the 3D box corners in the point cloud
box_T_mat = utils.get_box_transformation_matrix(label.box)
vertices = np.empty([2, 2, 2, 2])
for k in [0, 1]:
for l in [0, 1]:
for m in [0, 1]:
# 3D point in the box space
v = np.array([(k - 0.5), (l - 0.5), (m - 0.5), 1.])
vertices[k, l, m, :] = [v[0] / v[2], v[1] / v[2]]
# vertices = vertices.astype(np.int32)`
Hi,
This function takes a 3D bounding box described by its position, orientation and size and project its 8 corners onto an image. The array vertices
contains the 2D position (in pixels) of each corner in the image.
I assume that you are using the top 360° lidar. In this case, this function is not directly usable because it was designed for perspective projection whereas the range image is more like an equirectangular image using spherical coordinates.
Here is a variant of this function which I have used in another project to draw 3D bounding boxes into 360° panoramic images.
Have a look at this function to see the exact details of how the range image is mapped to a pointcloud in this dataset.