ashawkey / torch-ngp

A pytorch CUDA extension implementation of instant-ngp (sdf and nerf), with a GUI.
MIT License
2.11k stars 275 forks source link

Question on nerf matrix to ngp #169

Open ckLibra opened 1 year ago

ckLibra commented 1 year ago

Hi, thanks for your great project! I have a question on the pose conversion in provider. Your function nerf_matrix_to_ngp seems transpose [x,y,z] as [y,z,x], which is not applied in https://github.com/NVlabs/instant-ngp/blob/b76004c8cf478880227401ae763be4c02f80b62f/include/neural-graphics-primitives/nerf_loader.h#L50. I wonder the reason of this.

` def nerf_matrix_to_ngp(pose, scale=0.33, offset=[0, 0, 0]):

# for the fox dataset, 0.33 scales camera radius to ~ 2

new_pose = np.array([
    [pose[1, 0], -pose[1, 1], -pose[1, 2], pose[1, 3] * scale + offset[0]],
    [pose[2, 0], -pose[2, 1], -pose[2, 2], pose[2, 3] * scale + offset[1]],
    [pose[0, 0], -pose[0, 1], -pose[0, 2], pose[0, 3] * scale + offset[2]],
    [0, 0, 0, 1],
], dtype=np.float32)

return new_pose

`