mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-12-22 23:30:35 +08:00
allow cameras to be None in rasterizer initialization
Summary: Fix to enable a mesh/point rasterizer to be initialized without having to specify the camera. Reviewed By: jcjohnson, gkioxari Differential Revision: D21362359 fbshipit-source-id: 4f84ea18ad9f179c7b7c2289ebf9422a2f5e26de
This commit is contained in:
committed by
Facebook GitHub Bot
parent
9c5ab57156
commit
17ca6ecd81
@@ -48,7 +48,7 @@ class PointsRasterizer(nn.Module):
|
||||
This class implements methods for rasterizing a batch of pointclouds.
|
||||
"""
|
||||
|
||||
def __init__(self, cameras, raster_settings=None):
|
||||
def __init__(self, cameras=None, raster_settings=None):
|
||||
"""
|
||||
cameras: A cameras object which has a `transform_points` method
|
||||
which returns the transformed points after applying the
|
||||
@@ -80,6 +80,10 @@ class PointsRasterizer(nn.Module):
|
||||
be moved into forward.
|
||||
"""
|
||||
cameras = kwargs.get("cameras", self.cameras)
|
||||
if cameras is None:
|
||||
msg = "Cameras must be specified either at initialization \
|
||||
or in the forward pass of PointsRasterizer"
|
||||
raise ValueError(msg)
|
||||
|
||||
pts_world = point_clouds.points_padded()
|
||||
pts_world_packed = point_clouds.points_packed()
|
||||
|
||||
Reference in New Issue
Block a user