Commit eb2bbf84 authored by Jeremy Reizenstein's avatar Jeremy Reizenstein Committed by Facebook GitHub Bot
Browse files

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
parent 1152a93b
...@@ -45,7 +45,7 @@ All cameras inherit from `CamerasBase` which is a base class for all cameras. Py ...@@ -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]. * `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`. * `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_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. 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.
......
...@@ -250,7 +250,7 @@ class CamerasBase(TensorProperties): ...@@ -250,7 +250,7 @@ class CamerasBase(TensorProperties):
Returns the transform from camera projection space (screen or NDC) to NDC space. Returns the transform from camera projection space (screen or NDC) to NDC space.
For cameras that can be specified in screen space, this transform For cameras that can be specified in screen space, this transform
allows points to be converted from screen to NDC space. 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. 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, This function should be modified per camera definitions if need be,
e.g. for Perspective/Orthographic cameras we provide a custom implementation. e.g. for Perspective/Orthographic cameras we provide a custom implementation.
......
...@@ -637,7 +637,7 @@ class TestCamerasCommon(TestCaseMixin, unittest.TestCase): ...@@ -637,7 +637,7 @@ class TestCamerasCommon(TestCaseMixin, unittest.TestCase):
xyz_project_screen_naive = ndc_to_screen_points_naive( xyz_project_screen_naive = ndc_to_screen_points_naive(
xyz_project_ndc, image_size 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) self.assertClose(xyz_project_screen, xyz_project_screen_naive, atol=1e-4)
def test_equiv_project_points(self, batch_size=50, num_points=100): def test_equiv_project_points(self, batch_size=50, num_points=100):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment