Commit 69eff429 authored by VIOLANTE Nicolas's avatar VIOLANTE Nicolas
Browse files

fix alpha code

parent ba6e9397
......@@ -251,19 +251,17 @@ class EgoNet(nn.Module):
f = K[0, 0]
cx = K[0, 2]
kpts_x = [kpts[i][0, 0] for i in range(len(kpts))]
alphas = euler_angles[:, 1].copy()
alphas = np.copy(euler_angles)
for idx in range(len(euler_angles)):
ry3d = euler_angles[idx][
1
] # orientation in the camera coordinate system
ry3d = euler_angles[idx][1] # orientation in the camera coordinate system
x3d, z3d = kpts_x[idx] - cx, f
alpha = ry3d - math.atan2(-z3d, x3d) - 0.5 * math.pi
# alpha = ry3d - math.atan2(x3d, z3d)# - 0.5 * math.pi
while alpha > math.pi:
alpha -= math.pi * 2
while alpha < (-math.pi):
alpha += math.pi * 2
alphas[idx] = alpha
# while alpha > math.pi:
# alpha -= math.pi * 2
# while alpha < (-math.pi):
# alpha += math.pi * 2
alphas[idx][1] = alpha
return alphas
def get_template(self, prediction, interp_coef=[0.332, 0.667]):
......@@ -281,14 +279,14 @@ class EgoNet(nn.Module):
np.sum(lines[4:8]) / 4,
np.sum(lines[8:]) / 4,
)
x_corners = [l, l, l, l, 0, 0, 0, 0]
z_corners = [l, l, l, l, 0, 0, 0, 0]
y_corners = [0, h, 0, h, 0, h, 0, h]
z_corners = [w, w, 0, 0, w, w, 0, 0]
x_corners += -np.float32(l) / 2
x_corners = [w, w, 0, 0, w, w, 0, 0]
x_corners += -np.float32(w) / 2
# TODO: this was not like this!!!
# y_corners += - np.float32(h)
y_corners += -np.float32(h) / 2
z_corners += -np.float32(w) / 2
z_corners += -np.float32(l) / 2
corners_3d = np.array([x_corners, y_corners, z_corners])
# Add interpolated points between the 8 corners of the box
......@@ -431,9 +429,6 @@ class EgoNet(nn.Module):
# save_txt_file(img_path, record, save_dict)
return record
def estimate_pose(self, record):
self.get_6d_rep()
def post_process(
self,
records,
......
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