pandaset-devkit icon indicating copy to clipboard operation
pandaset-devkit copied to clipboard

How to visualise point cloud data with bounding boxes

Open LGNWJQ opened this issue 4 years ago • 1 comments

How to visualise point cloud data with bounding boxes

LGNWJQ avatar Oct 22 '21 08:10 LGNWJQ

You can grab the corners of each cuboid using the provided functions from the devkit, and then use code like the following to actually plot them (via whatever library you are using)

dataset_idx = '002'
time_idx = 0
cuboids = dataset[dataset_idx].cuboids
cuboids.load()
for idx, row in cuboids[time_idx].iterrows():
    box = pandaset.geometry.center_box_to_corners([row['position.x'],
                                                   row['position.y'],
                                                   row['position.z'],
                                                   row['dimensions.x'],
                                                   row['dimensions.y'],
                                                   row['dimensions.z'],
                                                   row['yaw']])
    bottom = [0,1,2,3,0]
    top = [4,5,6,7,4]
    edge1 = [0, 4]
    edge2 = [1, 5]
    edge3 = [2, 6]
    edge4 = [3, 7]
    for edgeset in [bottom, top, edge1, edge2, edge3, edge4]:
        ### REPLACE WITH YOUR FAVORITE DRAWING TOOL
        pass

gch avatar Oct 28 '21 23:10 gch