Skip to content
Snippets Groups Projects
Commit 3907be15 authored by SangminKim's avatar SangminKim
Browse files

Update colmap2nerf.py

handle reflection case with small noise
parent 1d312e1f
No related branches found
No related tags found
No related merge requests found
......@@ -128,11 +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)
if c < -1 + 1e-10:
return rotmat(a + np.random.uniform(-1e-2, 1e-2, 3), 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