Fix downscaling and type errors (#1164)

This commit is contained in:
Matthew Tancik authored and GitHub committed 2022-12-23 14:07:07 -07:00
1 parent fd33a1e950
commit 4a27e5e929
1 file changed
+8 -3
+8 -3
View File
@@ -66,6 +66,7 @@ def _render_trajectory_video(
CONSOLE.print("[bold green]Creating trajectory " + output_format)
cameras.rescale_output_resolution(rendered_resolution_scaling_factor)
cameras = cameras.to(pipeline.device)
fps = len(cameras) / seconds
progress = Progress(
TextColumn(":movie_camera: Rendering :movie_camera:"),
@@ -78,7 +79,6 @@ def _render_trajectory_video(
output_image_dir = output_filename.parent / output_filename.stem
output_image_dir.mkdir(parents=True, exist_ok=True)
if output_format == "video":
fps = len(cameras) / seconds
# make the folder if it doesn't exist
output_filename.parent.mkdir(parents=True, exist_ok=True)
# NOTE:
@@ -92,7 +92,12 @@ def _render_trajectory_video(
writer = (
stack.enter_context(
media.VideoWriter(
path=output_filename, shape=(render_height, render_width * len(rendered_output_names)), fps=fps
path=output_filename,
shape=(
int(render_height * rendered_resolution_scaling_factor),
int(render_width * rendered_resolution_scaling_factor) * len(rendered_output_names),
),
fps=fps,
)
)
if output_format == "video"
@@ -119,7 +124,7 @@ def _render_trajectory_video(
render_image = np.concatenate(render_image, axis=1)
if output_format == "images":
media.write_image(output_image_dir / f"{camera_idx:05d}.png", render_image)
if output_format == "video":
if output_format == "video" and writer is not None:
writer.add_image(render_image)
if output_format == "video":