Skip to content
Snippets Groups Projects
Commit 1d312e1f authored by SangminKim's avatar SangminKim
Browse files

Update colmap2nerf.py

handle exception for the opposite direction input
parent 3fa15bf7
No related branches found
No related tags found
No related merge requests found
......@@ -128,8 +128,11 @@ def qvec2rotmat(qvec):
def rotmat(a, b):
a, b = a / np.linalg.norm(a), b / np.linalg.norm(b)
v = np.cross(a, b)
c = np.dot(a, b)
# handle exception for the opposite direction input
if(c < -1 + 1e-10):
return -np.eye(3)
v = np.cross(a, b)
s = np.linalg.norm(v)
kmat = np.array([[0, -v[2], v[1]], [v[2], 0, -v[0]], [-v[1], v[0], 0]])
return np.eye(3) + kmat + kmat.dot(kmat) * ((1 - c) / (s ** 2 + 1e-10))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment