hailanyi / 3D-Detection-Tracking-Viewer

3D detection and tracking viewer (visualization) for kitti & waymo dataset
Apache License 2.0
406 stars 60 forks source link

draw motion track #8

Closed lx-ynu closed 1 year ago

lx-ynu commented 2 years ago

Hello, your paper also shows the motion trajectory drawn by you. I would like to ask if you can provide the relevant code for drawing the motion trajectory?

zzm-hl commented 2 years ago

have you solved it? thank you!

hailanyi commented 1 year ago

You can add some spheres in the viewer using add_spheres(track_points, del_after_show=False) to represent tracks. An example is as follows:

from viewer.viewer import Viewer
import numpy as np

vi = Viewer() # set box_type='OpenPCDet' if you use OpenPCDet boxes
len_dataset = 1000

for i in range(len_dataset):
    pseudo_boxes = np.array([[i*0.05, -1, 1, 1, 1, 1, 0], [i*0.05, 1, 1, 1, 1, 1, 0]]) # your boxes
    ids = np.array([0,1]) # your boxes ids (optional)

    pseudo_points = np.random.randn(100, 3) # your points

    vi.add_points(pseudo_points, radius=4, scatter_filed=pseudo_points[:, 0])
    vi.add_3D_boxes(pseudo_boxes, ids=ids,caption_size=(0.09,0.09))
    vi.add_spheres(pseudo_boxes[:, 0:3],radius=0.03,res=10,color='red',del_after_show=False, alpha=1) # Draw motion track
    vi.show_3D() # press the Enter key to view

exa

Jeremy26 commented 1 year ago

This won't generate the "trace" as you showed right? This will only generate a point in the box at the current time, just like add cars. Correct me if I'm wrong?