Expose camera frustums size and occlusions to CLI (#2556)

CLI expose for camera frustums
This commit is contained in:
Ethan Weber authored and GitHub committed 2023-10-26 16:56:58 -07:00
1 parent e4a0050d0d
commit 87773bb081
3 files changed
+13 -2

No files matched your search

+4
View File
@@ -148,3 +148,7 @@ class ViewerConfig(PrintableConfig):
"""Quality tradeoff to use for jpeg compression."""
make_share_url: bool = False
"""Viewer beta feature: print a shareable URL. `vis` must be set to viewer_beta; this flag is otherwise ignored."""
camera_frustum_scale: float = 0.1
"""Scale for the camera frustums in the viewer."""
default_composite_depth: bool = True
"""The default value for compositing depth. Turn off if you want to see the camera frustums without occlusions."""
+7 -1
View File
@@ -45,6 +45,7 @@ class ControlPanel:
(eg train speed, max res, etc)
crop_update_cb: a callback that will be called when the user changes the crop parameters
update_output_cb: a callback that will be called when the user changes the output render
default_composite_depth: whether to default to compositing depth or not
"""
def __init__(
@@ -58,11 +59,13 @@ class ControlPanel:
update_split_output_cb: Callable,
toggle_training_state_cb: Callable,
camera_vis: Callable,
default_composite_depth: bool = True,
):
self.viser_scale_ratio = scale_ratio
# elements holds a mapping from tag: [elements]
self.viser_server = viser_server
self._elements_by_tag: DefaultDict[str, List[ViewerElement]] = defaultdict(lambda: [])
self.default_composite_depth = default_composite_depth
self._train_speed = ViewerButtonGroup(
name="Train Speed",
@@ -131,7 +134,10 @@ class ControlPanel:
hint="Target training utilization, 0.0 is slow, 1.0 is fast. Doesn't affect final render quality",
)
self._layer_depth = ViewerCheckbox(
"Composite Depth", True, cb_hook=rerender_cb, hint="Allow NeRF to occlude 3D browser objects"
"Composite Depth",
self.default_composite_depth,
cb_hook=rerender_cb,
hint="Allow NeRF to occlude 3D browser objects",
)
self._max_res = ViewerSlider(
"Max Res", 512, 64, 2048, 100, cb_hook=rerender_cb, hint="Maximum resolution to render in viewport"
+2 -1
View File
@@ -154,6 +154,7 @@ class Viewer:
self._output_split_type_change,
self._toggle_training_state,
self.set_camera_visibility,
default_composite_depth=self.config.default_composite_depth,
)
config_path = self.log_filename.parents[0] / "config.yml"
with tabs.add_tab("Render", viser.Icon.CAMERA):
@@ -331,7 +332,7 @@ class Viewer:
camera_handle = self.viser_server.add_camera_frustum(
name=f"/cameras/camera_{idx:05d}",
fov=float(2 * np.arctan(camera.cx / camera.fx[0])),
scale=0.1,
scale=self.config.camera_frustum_scale,
aspect=float(camera.cx[0] / camera.cy[0]),
image=image_uint8,
wxyz=R.wxyz,