Refactoring (data loading, semantic-nerf/nerf-w fixes, ...) (#8)

* in progress. camera_indices broken

* faster dataloader. starting on pixel sampler logic

* imagesampler and pixelsampler

* lint and black

* continuing merge

* pytest working

* fixed docs

* docs

* minor changes
This commit is contained in:
Ethan Weber authored and GitHub committed 2022-06-02 14:58:46 -04:00
1 parent 1f189b3e54
commit 146332cfb6
50 files changed
+914 -831

No files matched your search

+8 -4
View File
@@ -98,17 +98,21 @@ class Camera:
"""
return
def generate_camera_rays(self) -> RayBundle:
def generate_camera_rays(self, device=None) -> RayBundle:
"""Generate rays for the camera.
Returns:
Rays: Camera rays of shape [height, width]
"""
if device is None:
device = self.camera_to_world.device
height = self.get_image_height()
width = self.get_image_width()
intrinsics = self.get_intrinsics().unsqueeze(0).repeat(height, width, 1) # (num_rays, num_intrinsics_params)
camera_to_world = self.camera_to_world.unsqueeze(0).repeat(height, width, 1, 1) # (num_rays, 3, 4)
coords = self.get_image_coords()
intrinsics = (
self.get_intrinsics().unsqueeze(0).repeat(height, width, 1).to(device)
) # (num_rays, num_intrinsics_params)
camera_to_world = self.camera_to_world.unsqueeze(0).repeat(height, width, 1, 1).to(device) # (num_rays, 3, 4)
coords = self.get_image_coords().to(device)
ray_bundle = self.generate_rays(intrinsics, camera_to_world, coords)
return ray_bundle