mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-12-20 22:30:35 +08:00
Make transform_points_screen's with_xyflip configurable
Summary: We'll need non-flipped screen coords in splatter. Reviewed By: bottler Differential Revision: D36337027 fbshipit-source-id: 897f88e8854bab215d2d0e502b25d15526ee86f1
This commit is contained in:
committed by
Facebook GitHub Bot
parent
61e2b87019
commit
4372001981
@@ -204,6 +204,9 @@ class TestPixels(TestCaseMixin, unittest.TestCase):
|
||||
for cameras in (data.camera_ndc, data.camera_screen):
|
||||
ndc_points = cameras.transform_points_ndc(points)
|
||||
screen_points = cameras.transform_points_screen(points)
|
||||
screen_points_without_xyflip = cameras.transform_points_screen(
|
||||
points, with_xyflip=False
|
||||
)
|
||||
camera_points = cameras.transform_points(points)
|
||||
for batch_idx in range(2):
|
||||
# NDC space agrees with the original
|
||||
@@ -214,6 +217,13 @@ class TestPixels(TestCaseMixin, unittest.TestCase):
|
||||
torch.tensor([data.x + 0.5, data.y + 0.5, 1.0]),
|
||||
atol=1e-5,
|
||||
)
|
||||
# Screen coords without xyflip should have x, y that negate the non-
|
||||
# flipped values, and unchanged z.
|
||||
self.assertClose(
|
||||
screen_points_without_xyflip[batch_idx][0],
|
||||
torch.tensor([-(data.x + 0.5), -(data.y + 0.5), 1.0]),
|
||||
atol=1e-5,
|
||||
)
|
||||
# Second point in screen space is the center of the screen
|
||||
self.assertClose(
|
||||
screen_points[batch_idx][1],
|
||||
|
||||
Reference in New Issue
Block a user