Skip to content

Commit

Permalink
screen space docstrings fix
Browse files Browse the repository at this point in the history
Summary: Fix some comments to match the recent change to transform_points_screen.

Reviewed By: patricklabatut

Differential Revision: D33243697

fbshipit-source-id: dc8d182667a9413bca2c2e3657f97b2f7a47c795
  • Loading branch information
bottler authored and facebook-github-bot committed Dec 21, 2021
1 parent 1152a93 commit eb2bbf8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/notes/cameras.md
Expand Up @@ -45,7 +45,7 @@ All cameras inherit from `CamerasBase` which is a base class for all cameras. Py
* `transform_points` which takes a set of input points in world coordinates and projects to NDC coordinates ranging from [-1, -1, znear] to [+1, +1, zfar].
* `get_ndc_camera_transform` which defines the conversion to PyTorch3D's NDC space and is called when interfacing with the PyTorch3D renderer. If the camera is defined in NDC space, then the identity transform is returned. If the cameras is defined in screen space, the conversion from screen to NDC is returned. If users define their own camera in screen space, they need to think of the screen to NDC conversion. We provide examples for the `PerspectiveCameras` and `OrthographicCameras`.
* `transform_points_ndc` which takes a set of points in world coordinates and projects them to PyTorch3D's NDC space
* `transform_points_screen` which takes a set of input points in world coordinates and projects them to the screen coordinates ranging from [0, 0, znear] to [W-1, H-1, zfar]
* `transform_points_screen` which takes a set of input points in world coordinates and projects them to the screen coordinates ranging from [0, 0, znear] to [W, H, zfar]

Users can easily customize their own cameras. For each new camera, users should implement the `get_projection_transform` routine that returns the mapping `P` from camera view coordinates to NDC coordinates.

Expand Down
2 changes: 1 addition & 1 deletion pytorch3d/renderer/cameras.py
Expand Up @@ -250,7 +250,7 @@ def get_ndc_camera_transform(self, **kwargs) -> Transform3d:
Returns the transform from camera projection space (screen or NDC) to NDC space.
For cameras that can be specified in screen space, this transform
allows points to be converted from screen to NDC space.
The default transform scales the points from [0, W-1]x[0, H-1]
The default transform scales the points from [0, W]x[0, H]
to [-1, 1]x[-u, u] or [-u, u]x[-1, 1] where u > 1 is the aspect ratio of the image.
This function should be modified per camera definitions if need be,
e.g. for Perspective/Orthographic cameras we provide a custom implementation.
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cameras.py
Expand Up @@ -637,7 +637,7 @@ def test_project_points_screen(self, batch_size=50, num_points=100):
xyz_project_screen_naive = ndc_to_screen_points_naive(
xyz_project_ndc, image_size
)
# we set atol to 1e-4, remember that screen points are in [0, W-1]x[0, H-1] space
# we set atol to 1e-4, remember that screen points are in [0, W]x[0, H] space
self.assertClose(xyz_project_screen, xyz_project_screen_naive, atol=1e-4)

def test_equiv_project_points(self, batch_size=50, num_points=100):
Expand Down

0 comments on commit eb2bbf8

Please sign in to comment.