mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-05 15:28:49 +08:00
Fix crop robustness (#1321)
This commit is contained in:
1 parent
f3b3a517e8
commit
79395ecd8d
2 files changed
+10
-4
No files matched your search
@@ -147,6 +147,8 @@ class Cameras(TensorDataclass):
|
|||||||
|
|
||||||
self.__post_init__() # This will do the dataclass post_init and broadcast all the tensors
|
self.__post_init__() # This will do the dataclass post_init and broadcast all the tensors
|
||||||
|
|
||||||
|
self._use_nerfacc = strtobool(os.environ.get("INTERSECT_WITH_NERFACC", "TRUE"))
|
||||||
|
|
||||||
def _init_get_fc_xy(self, fc_xy, name):
|
def _init_get_fc_xy(self, fc_xy, name):
|
||||||
"""
|
"""
|
||||||
Parses the input focal length / principle point x or y and returns a tensor of the correct shape
|
Parses the input focal length / principle point x or y and returns a tensor of the correct shape
|
||||||
@@ -470,9 +472,13 @@ class Cameras(TensorDataclass):
|
|||||||
rays_o = rays_o.reshape((-1, 3))
|
rays_o = rays_o.reshape((-1, 3))
|
||||||
rays_d = rays_d.reshape((-1, 3))
|
rays_d = rays_d.reshape((-1, 3))
|
||||||
|
|
||||||
if strtobool(os.environ.get("INTERSECT_WITH_NERFACC", "TRUE")):
|
if self._use_nerfacc:
|
||||||
nerfacc = importlib.import_module("nerfacc")
|
try:
|
||||||
t_min, t_max = nerfacc.ray_aabb_intersect(rays_o, rays_d, tensor_aabb)
|
nerfacc = importlib.import_module("nerfacc")
|
||||||
|
t_min, t_max = nerfacc.ray_aabb_intersect(rays_o, rays_d, tensor_aabb)
|
||||||
|
except: # pylint: disable=bare-except
|
||||||
|
t_min, t_max = nerfstudio.utils.math.intersect_aabb(rays_o, rays_d, tensor_aabb)
|
||||||
|
self._use_nerfacc = False
|
||||||
else:
|
else:
|
||||||
t_min, t_max = nerfstudio.utils.math.intersect_aabb(rays_o, rays_d, tensor_aabb)
|
t_min, t_max = nerfstudio.utils.math.intersect_aabb(rays_o, rays_d, tensor_aabb)
|
||||||
|
|
||||||
|
|||||||
@@ -940,7 +940,7 @@ class ViewerState:
|
|||||||
)
|
)
|
||||||
camera = camera.to(graph.device)
|
camera = camera.to(graph.device)
|
||||||
|
|
||||||
camera_ray_bundle = camera.generate_rays(camera_indices=0)
|
camera_ray_bundle = camera.generate_rays(camera_indices=0, aabb_box=graph.render_aabb)
|
||||||
|
|
||||||
graph.eval()
|
graph.eval()
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user