Skip to content

Commit 5b5622a

Browse files
committed
update 2d viewer
1 parent d8230bd commit 5b5622a

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

kitti_3D_detection_viewer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
from dataset.kitti_dataset import KittiDetectionDataset
44

55
def kitti_viewer():
6-
root="H:/data/object detection/kitti/training"
7-
label_path = "H:/data/object detection/kitti/training/label_2"
6+
root=r"L:\data\kitti\detection\kitti\training"
7+
label_path = r"L:\data\kitti\detection\kitti\training\label_2"
88
dataset = KittiDetectionDataset(root,label_path)
99

1010
vi = Viewer(box_type="Kitti")
@@ -23,7 +23,7 @@ def kitti_viewer():
2323
vi.add_image(image)
2424
vi.set_extrinsic_mat(V2C)
2525
vi.set_intrinsic_mat(P2)
26-
vi.show_2D()
26+
vi.show_2D(show_box_heading=False)
2727
vi.show_3D()
2828

2929

viewer/box_op.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ def get_line_boxes(boxes,
205205

206206
return return_list
207207

208-
def get_box_points(points, pose=None):
208+
def get_box_points(points, pose=None,show_box_heading=True):
209209
"""
210210
box to points
211211
:param points: (7,),box
@@ -323,7 +323,10 @@ def get_box_points(points, pose=None):
323323
l4[:, 2] = h / 2
324324
l4[:, 3] = i
325325

326-
point_mat=np.mat(np.concatenate((z1,z2,z3,z4,w1,w2,w3,w4,l1,l2,l3,l4,d1,d2,d3,d4)))#
326+
if show_box_heading:
327+
point_mat = np.mat(np.concatenate((z1, z2, z3, z4, w1, w2, w3, w4, l1, l2, l3, l4, d1, d2, d3, d4)))
328+
else:
329+
point_mat = np.mat(np.concatenate((z1, z2, z3, z4, w1, w2, w3, w4, l1, l2, l3, l4)))
327330

328331
angle=point[6]-PI/2
329332

viewer/viewer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ def show_3D(self):
404404
self.points_info.clear()
405405
self.boxes_info.clear()
406406

407-
def show_2D(self,box_color = (255,0,0),show_box_info=False,show_ids=True,points_colors=(0,0,255)):
407+
def show_2D(self,box_color = (255,0,0),show_box_info=False,show_ids=True,points_colors=(0,0,255), show_box_heading=True):
408408
"""
409409
show object on image
410410
:param box_color: (list or tuple(3,)), default color
@@ -435,7 +435,7 @@ def show_2D(self,box_color = (255,0,0),show_box_info=False,show_ids=True,points_
435435
else:
436436
color = box_color
437437

438-
pts_3d_cam = get_box_points(box)
438+
pts_3d_cam = get_box_points(box,show_box_heading=show_box_heading)
439439
pts_3d_cam = velo_to_cam(pts_3d_cam[:,0:3],self.cam_extrinsic_mat)
440440

441441
all_img_pts = np.matmul(pts_3d_cam, self.cam_intrinsic_mat.T) # (N, 3)

0 commit comments

Comments
 (0)