facebookresearch / pytorch3d

PyTorch3D is FAIR's library of reusable components for deep learning with 3D data
https://pytorch3d.org/
Other
8.71k stars 1.31k forks source link

Wrong documentation #1741

Open amirhagai opened 7 months ago

amirhagai commented 7 months ago

The documentation for the "get_projection_transform" function within the "FoVPerspectiveCameras" class, found in the "renderer/cameras.py" file, appears to contain an inconsistency regarding the calculation of s1 and s2. According to the documentation, the variables are defined as follows:

However, in practice, the definitions for s1 and s2 seem to be reversed:

for example -

self.compute_projection_matrix(znear, zfar, fov, aspect_ratio=1., degrees=degrees)

tensor([[[109.4238, 0.0000, 0.0000, 0.0000], [ 0.0000, 109.4238, 0.0000, 0.0000], [ 0.0000, 0.0000, 1.0101, -1.0101], [ 0.0000, 0.0000, 1.0000, 0.0000]]])

self.compute_projection_matrix(znear, zfar, fov, aspect_ratio=2., degrees=degrees)

tensor([[[ 54.7119, 0.0000, 0.0000, 0.0000], [ 0.0000, 109.4238, 0.0000, 0.0000], [ 0.0000, 0.0000, 1.0101, -1.0101], [ 0.0000, 0.0000, 1.0000, 0.0000]]])

bottler commented 7 months ago

I think you're right - and that comment has always been the wrong way round. Do you want to send a PR to fix it?