forked from hailanyi/3D-Detection-Tracking-Viewer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
kitti_3D_detection_viewer.py
31 lines (24 loc) · 954 Bytes
/
kitti_3D_detection_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
from viewer.viewer import Viewer
import numpy as np
from dataset.kitti_dataset import KittiDetectionDataset
def kitti_viewer():
root="H:/data/object detection/kitti/training"
label_path = "H:/data/object detection/kitti/training/label_2"
dataset = KittiDetectionDataset(root,label_path)
vi = Viewer(box_type="Kitti")
vi.set_ob_color_map('gnuplot')
for i in range(len(dataset)):
P2, V2C, points, image, labels, label_names = dataset[i]
mask = label_names=="Car"
labels = labels[mask]
label_names = label_names[mask]
vi.add_points(points[:,:3],scatter_filed=points[:,2],color_map_name='viridis')
vi.add_3D_boxes(labels,box_info=label_names)
vi.add_3D_cars(labels, box_info=label_names)
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()