Skip to content

Commit

Permalink
fix gui
Browse files Browse the repository at this point in the history
  • Loading branch information
ashawkey committed Apr 12, 2022
1 parent ad6ed81 commit 7dc5483
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion nerf/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def pose(self):
@property
def intrinsics(self):
focal = self.H / (2 * np.tan(np.radians(self.fovy) / 2))
return np.array([focal, focal, self.H // 2, self.W // 2])
return np.array([focal, focal, self.W // 2, self.H // 2])

def orbit(self, dx, dy):
# rotate along camera up/side axis!
Expand Down
8 changes: 4 additions & 4 deletions nerf/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ def train_gui(self, train_loader, step=16):

# mark untrained grid
if self.global_step == 0:
self.model.mark_untrained_grid(train_loader.dataset.poses, train_loader.dataset.intrinsic)
self.model.mark_untrained_grid(train_loader._data.poses, train_loader._data.intrinsics)
self.error_map = train_loader._data.error_map

# update grid every 16 steps
Expand Down Expand Up @@ -587,11 +587,11 @@ def test_gui(self, pose, intrinsics, W, H, bg_color=None, spp=1, downscale=1):

pose = torch.from_numpy(pose).unsqueeze(0).to(self.device)

rays_o, rays_d, inds = get_rays(pose, self.intrinsics, rH, rW, -1)
rays = get_rays(pose, intrinsics, rH, rW, -1)

data = {
'rays_o': rays_o,
'rays_d': rays_d,
'rays_o': rays['rays_o'],
'rays_d': rays['rays_d'],
'H': rH,
'W': rW,
}
Expand Down
8 changes: 4 additions & 4 deletions tensoRF/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ def train_gui(self, train_loader, step=16):

# mark untrained grid
if self.global_step == 0:
self.model.mark_untrained_grid(train_loader.dataset.poses, train_loader.dataset.intrinsic)
self.model.mark_untrained_grid(train_loader._data.poses, train_loader._data.intrinsics)
self.error_map = train_loader._data.error_map

# update grid every 16 steps
Expand Down Expand Up @@ -594,11 +594,11 @@ def test_gui(self, pose, intrinsics, W, H, bg_color=None, spp=1, downscale=1):

pose = torch.from_numpy(pose).unsqueeze(0).to(self.device)

rays_o, rays_d, inds = get_rays(pose, self.intrinsics, rH, rW, -1)
rays = get_rays(pose, intrinsics, rH, rW, -1)

data = {
'rays_o': rays_o,
'rays_d': rays_d,
'rays_o': rays['rays_o'],
'rays_d': rays['rays_d'],
'H': rH,
'W': rW,
}
Expand Down

0 comments on commit 7dc5483

Please sign in to comment.