diff --git a/docs/notes/cameras.md b/docs/notes/cameras.md index 6b913e42..2ce73850 100644 --- a/docs/notes/cameras.md +++ b/docs/notes/cameras.md @@ -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. diff --git a/pytorch3d/renderer/cameras.py b/pytorch3d/renderer/cameras.py index f1e813c9..70e0f1ce 100644 --- a/pytorch3d/renderer/cameras.py +++ b/pytorch3d/renderer/cameras.py @@ -250,7 +250,7 @@ class CamerasBase(TensorProperties): 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. diff --git a/tests/test_cameras.py b/tests/test_cameras.py index e29c7d3f..15fd355a 100644 --- a/tests/test_cameras.py +++ b/tests/test_cameras.py @@ -637,7 +637,7 @@ class TestCamerasCommon(TestCaseMixin, unittest.TestCase): 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):