yenchenlin / nerf-pytorch

A PyTorch implementation of NeRF (Neural Radiance Fields) that reproduces the results.
MIT License
5.47k stars 1.06k forks source link

c2w: what does the last operation mean? #84

Open Junwei-LV opened 2 years ago

Junwei-LV commented 2 years ago

`def pose_spherical(theta, phi, radius): c2w = trans_t(radius)

print(c2w)

c2w = rot_phi(phi / 180. * np.pi) @ c2w 
# print(c2w)
c2w = rot_theta(theta / 180. * np.pi) @ c2w  
# print(c2w)
c2w = torch.Tensor(np.array([[-1, 0, 0, 0], [0, 0, 1, 0], [0, 1, 0, 0], [0, 0, 0, 1]])) @ c2w
return c2w 

what does the last operation mean? why does c2w need to change to 'np.array([[-1, 0, 0, 0], [0, 0, 1, 0], [0, 1, 0, 0], [0, 0, 0, 1]]'??? thanks

lenn-arts commented 1 year ago

I believe the @ sign at the end is pytorch's matrix multiplication so you do not replace c2w but you rather mask it with the first tensor.