-
Notifications
You must be signed in to change notification settings - Fork 62
/
kitti_3D_tracking_viewer.py
34 lines (24 loc) · 1005 Bytes
/
kitti_3D_tracking_viewer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from viewer.viewer import Viewer
import numpy as np
from dataset.kitti_dataset import KittiTrackingDataset
def kitti_viewer():
root="H:/data/tracking/training"
label_path = r"H:/data/tracking/training/label_02/0001.txt"
dataset = KittiTrackingDataset(root,seq_id=1,label_path=label_path)
vi = Viewer(box_type="Kitti")
for i in range(len(dataset)):
P2, V2C, points, image, labels, label_names = dataset[i]
if labels is not None:
mask = (label_names=="Car")
labels = labels[mask]
label_names = label_names[mask]
vi.add_3D_boxes(labels, ids=labels[:, -1].astype(int), box_info=label_names,caption_size=(0.09,0.09))
vi.add_3D_cars(labels, ids=labels[:, -1].astype(int), mesh_alpha=1)
vi.add_points(points[:,:3])
vi.add_image(image)
vi.set_extrinsic_mat(V2C)
vi.set_intrinsic_mat(P2)
vi.show_2D()
vi.show_3D()
if __name__ == '__main__':
kitti_viewer()