Open UestcJay opened 2 years ago
@krrish94 me too, what this line for ? ray_directions = torch.sum( directions[..., None, :] * tform_cam2world[:3, :3], dim=-1 )`
+1 what's different?
`def get_rays(H, W, K, R, T):
rays_o = -np.dot(R.T, T).ravel()
i, j = np.meshgrid(np.arange(W, dtype=np.float32),np.arange(H, dtype=np.float32), indexing='xy')
xy1 = np.stack([i, j, np.ones_like(i)], axis=2)
pixel_camera = np.dot(xy1, np.linalg.inv(K).T)
pixel_world = np.dot(pixel_camera - T.ravel(), R)
rays_d = pixel_world - rays_o[None, None]
rays_o = np.broadcast_to(rays_o, rays_d.shape)
return rays_o, rays_d`
thanks for your great work! I have question about getting ray_directions. can you give me some sepcific introduction? ` ii, jj = meshgrid_xy( torch.arange( width, dtype=tform_cam2world.dtype, device=tform_cam2world.device ).to(tform_cam2world), torch.arange( height, dtype=tform_cam2world.dtype, device=tform_cam2world.device ), )