4
0
mirror of https://github.com/nerfstudio-project/nerfstudio.git synced 2026-11-11 02:24:38 +08:00

Allows rendering the appearance of specific training camera indices (#3346)

allows render given camera idx
This commit is contained in:
Congrong Xu 2024-08-06 01:41:55 +08:00 committed by GitHub
parent b0dd3d4730
commit 9ffbc374f4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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,