in metropolis/utils/data_classes.py [0:0]
def project(points):
# From pixel coordinates to angles
u = (points[0] / size_eq[0] - 0.5) * 2 * np.pi
v = (points[1] / size_eq[1] - 0.5) * np.pi
# From angles to 3D coordinates on the sphere
p_eq = np.stack(
[np.cos(v) * np.sin(u), np.sin(v), np.cos(v) * np.cos(u)], axis=0
)
# Rotate to target camera
p_pr = np.dot(q_pr.rotation_matrix.T, np.dot(q_eq.rotation_matrix, p_eq))
# Filter out points that end up behind the camera
p_pr = p_pr[:, p_pr[2] > 0]
# Apply camera intrinsics and project
p_pr = np.dot(intrinsic, p_pr)
p_pr = np.stack([p_pr[0] / p_pr[2], p_pr[1] / p_pr[2]], axis=0)
return p_pr