Commit 165c79ca authored by VIOLANTE Nicolas's avatar VIOLANTE Nicolas
Browse files

black code

parent bcbbf321
......@@ -7,7 +7,7 @@ import polyscope as ps
ObjectBox = namedtuple("ObjectBox", ["coord_system", "vertices", "faces", "name"])
CoordSystem = namedtuple("CoordSystem", ["basis", "origin"])
interp_coef=[0.332, 0.667]
interp_coef = [0.332, 0.667]
faces = np.array(
[
[3, 2, 0],
......@@ -206,12 +206,14 @@ if __name__ == "__main__":
record = np.load(
f"./camera_calib/results/img0000{num}.npy", allow_pickle=True
).item()
cam2world = np.array(record['cam2world']).reshape(4, 4)
cam2world = np.array(record["cam2world"]).reshape(4, 4)
cam = transform_coord_system(eg3d_object_sys, cam2world)
cams[num] = cam
# Load reference cat annotations
canonical_box = ObjectBox(eg3d_object_sys, create_canonical_box(3/5, 1.5/5, 1.5/5), faces, "box")
canonical_box = ObjectBox(
eg3d_object_sys, create_canonical_box(3 / 5, 1.5 / 5, 1.5 / 5), faces, "box"
)
cam2world = np.array(
[
0.9931507213317242,
......@@ -234,7 +236,7 @@ if __name__ == "__main__":
).reshape(4, 4)
cam = transform_coord_system(eg3d_object_sys, cam2world)
cams['right-cat'] = cam
cams["right-cat"] = cam
cam2world = np.array(
[
......@@ -257,7 +259,7 @@ if __name__ == "__main__":
]
).reshape(4, 4)
cam = transform_coord_system(eg3d_object_sys, cam2world)
cams['left-cat']= cam
cams["left-cat"] = cam
ps.init()
ps.set_ground_plane_mode("none")
......
import numpy as np
import polyscope as ps
import cv2 as cv
from cam2world import (
CoordSystem,
create_box,
......@@ -7,22 +9,24 @@ from cam2world import (
faces,
add_coords,
add_box,
transform_coord_system,
eg3d_object_sys
eg3d_object_sys,
)
if __name__ == "__main__":
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()
record = np.load(
f"./camera_calib/results/img0000{num}.npy", allow_pickle=True
).item()
cam2world = np.array(record["cam2world"]).reshape(4, 4)
world2cam = np.linalg.inv(cam2world)
angles = cv.Rodrigues(world2cam[:3, :3])[0][:, 0] * 180 / np.pi
print(angles)
box = create_box(
world2cam,
eg3d_object_sys,
create_canonical_box(3.0, 1.5, 1.5),
create_canonical_box(3.0 / 5, 1.5 / 5, 1.5 / 5),
faces,
f"car {num}",
)
......
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