From 9ffbc374f43feca5ad1a7ebe99d3acb70866ebc8 Mon Sep 17 00:00:00 2001 From: Congrong Xu <50019703+KevinXu02@users.noreply.github.com> Date: Tue, 6 Aug 2024 01:41:55 +0800 Subject: [PATCH] Allows rendering the appearance of specific training camera indices (#3346) allows render given camera idx --- nerfstudio/scripts/render.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/nerfstudio/scripts/render.py b/nerfstudio/scripts/render.py index 60bcaa9eb..70208a45d 100644 --- a/nerfstudio/scripts/render.py +++ b/nerfstudio/scripts/render.py @@ -430,6 +430,8 @@ class BaseRender: """Whether to render the nearest training camera to the rendered camera.""" check_occlusions: bool = False """If true, checks line-of-sight occlusions when computing camera distance and rejects cameras not visible to each other""" + camera_idx: Optional[int] = None + """Index of the training camera to render.""" @dataclass @@ -480,6 +482,9 @@ class RenderCameraPath(BaseRender): if self.output_format == "video" and str(self.output_path.suffix) == "": self.output_path = self.output_path.with_suffix(".mp4") + if self.camera_idx is not None: + camera_path.metadata = {"cam_idx": self.camera_idx} + _render_trajectory_video( pipeline, camera_path, @@ -617,6 +622,9 @@ class RenderInterpolated(BaseRender): order_poses=self.order_poses, ) + if self.camera_idx is not None: + camera_path.metadata = {"cam_idx": self.camera_idx} + _render_trajectory_video( pipeline, camera_path, @@ -669,6 +677,9 @@ class SpiralRender(BaseRender): camera_start, _ = pipeline.datamanager.eval_dataloader.get_camera(image_idx=0) camera_path = get_spiral_path(camera_start, steps=steps, radius=self.radius) + if self.camera_idx is not None: + camera_path.metadata = {"cam_idx": self.camera_idx} + _render_trajectory_video( pipeline, camera_path,