nerfstudio icon indicating copy to clipboard operation
nerfstudio copied to clipboard

conversion between the colmap qvec, tvec and NeRF render json

Open Ting-Wei-Chang626 opened this issue 1 year ago • 3 comments

I'm wondering how to transfer the colmap result into camera_path to render.

I have tried the script in colmap_to_json.py to transform the qvec and tvec into c2w matrix. R = qvec2rotmat(qvec) t = tvec.reshape([3,1]) w2c = np.concatenate([R, t], 1) w2c = np.concatenate([w2c, np.array([[0, 0, 0, 1]])], 0) c2w = np.linalg.inv(w2c) c2w[0:3, 1:3] *= -1 c2w = c2w[np.array([1, 0, 2, 3]), :] c2w[2, :] *= -1

And then write it into the camera_path.json. just like 螢幕快照 2024-01-31 132425

It seems the render result is different from expectation. And, the camera is in the wrong position. Do anyone know that the correct conversion between colmap trajectory and NeRF render path?

Ting-Wei-Chang626 avatar Jan 31 '24 06:01 Ting-Wei-Chang626

It's possible you need to consider the dataparser transform too, which scales and shifts the poses to be centered at the origin with a scale of 1.

kerrj avatar Jan 31 '24 18:01 kerrj

facing similar problem

sean880304 avatar Feb 01 '24 03:02 sean880304

In my case, I use nerfstudio to visualize the result from Gaussian Splatting. The scale and origin of imported point cloud is same with the original colmap one.

Does nerfstudio change the original and scale while rendering the trained result?

Ting-Wei-Chang626 avatar Feb 02 '24 00:02 Ting-Wei-Chang626