Commit 34202dd8 authored by nviolante's avatar nviolante
Browse files

add support for multiple cars

parent 5b842f95
......@@ -223,28 +223,32 @@ def transform_points(object_sys, points, transformation):
if __name__ == "__main__":
record = np.load(
"./camera_calib/results/img00001075.npy", allow_pickle=True
).item()
rotation = record["rotation"].reshape(4, 4)
rotation[:3, -1] = np.zeros(3)
h = get_box_height(record["kpts_3d_pred"][0])
cam2world = to_eg3d(rotation, h)
eg3d_camera_sys = CoordSystem(
basis=np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]]),
origin=np.array([[0, 0, 0]]),
)
translation = np.eye(4, dtype=np.float32)
translation[2, -1] = 2.7
nums = [1046, 1052, 1063, 1071, 1075, 1132, 1133, 1134]
boxes = []
for num in nums:
record = np.load(
f"./camera_calib/results/img0000{num}.npy", allow_pickle=True
).item()
rotation = record["rotation"].reshape(4, 4)
rotation[:3, -1] = np.zeros(3)
h = get_box_height(record["kpts_3d_pred"][0])
cam2world = to_eg3d(rotation, h)
eg3d_camera_sys = CoordSystem(
basis=np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]]),
origin=np.array([[0, 0, 0]]),
)
translation = np.eye(4, dtype=np.float32)
translation[2, -1] = 2.7
box = create_box(
translation @ rotation,
eg3d_camera_sys,
create_canonical_box(prediction=record["kpts_3d_pred"][0]),
faces,
"car 1075",
)
box = create_box(
translation @ rotation,
eg3d_camera_sys,
create_canonical_box(prediction=record["kpts_3d_pred"][0]),
faces,
f"car {num}",
)
boxes.append(box)
ps.init()
ps.set_ground_plane_mode("none")
......@@ -253,6 +257,8 @@ if __name__ == "__main__":
add_coords(
"EG3D object system", transform_coord_system(eg3d_camera_sys, cam2world)
)
add_box(box, color=(0, 1, 0))
for box in boxes:
c = np.random.rand(3)
add_box(box, color=(c[0], c[1], c[2]))
ps.show()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment