Skip to content

Commit eb2bbf8

Browse files
bottlerfacebook-github-bot
authored andcommitted
screen space docstrings fix
Summary: Fix some comments to match the recent change to transform_points_screen. Reviewed By: patricklabatut Differential Revision: D33243697 fbshipit-source-id: dc8d182667a9413bca2c2e3657f97b2f7a47c795
1 parent 1152a93 commit eb2bbf8

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

docs/notes/cameras.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ All cameras inherit from `CamerasBase` which is a base class for all cameras. Py
4545
* `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].
4646
* `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`.
4747
* `transform_points_ndc` which takes a set of points in world coordinates and projects them to PyTorch3D's NDC space
48-
* `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]
48+
* `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]
4949

5050
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.
5151

pytorch3d/renderer/cameras.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ def get_ndc_camera_transform(self, **kwargs) -> Transform3d:
250250
Returns the transform from camera projection space (screen or NDC) to NDC space.
251251
For cameras that can be specified in screen space, this transform
252252
allows points to be converted from screen to NDC space.
253-
The default transform scales the points from [0, W-1]x[0, H-1]
253+
The default transform scales the points from [0, W]x[0, H]
254254
to [-1, 1]x[-u, u] or [-u, u]x[-1, 1] where u > 1 is the aspect ratio of the image.
255255
This function should be modified per camera definitions if need be,
256256
e.g. for Perspective/Orthographic cameras we provide a custom implementation.

tests/test_cameras.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ def test_project_points_screen(self, batch_size=50, num_points=100):
637637
xyz_project_screen_naive = ndc_to_screen_points_naive(
638638
xyz_project_ndc, image_size
639639
)
640-
# we set atol to 1e-4, remember that screen points are in [0, W-1]x[0, H-1] space
640+
# we set atol to 1e-4, remember that screen points are in [0, W]x[0, H] space
641641
self.assertClose(xyz_project_screen, xyz_project_screen_naive, atol=1e-4)
642642

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

0 commit comments

Comments
 (0)