diff --git a/src/sharp/utils/io.py b/src/sharp/utils/io.py index 07a98be..bee5d97 100644 --- a/src/sharp/utils/io.py +++ b/src/sharp/utils/io.py @@ -189,6 +189,7 @@ def __init__(self, output_path: Path, fps: float = 30.0, render_depth: bool = Tr self.image_writer = iio.get_writer(output_path, fps=fps) self.max_depth_estimate = None + self.depth_writer = None if render_depth: self.depth_writer = iio.get_writer(output_path.with_suffix(".depth.mp4"), fps=fps) @@ -211,3 +212,5 @@ def add_frame(self, image: torch.Tensor, depth: torch.Tensor) -> None: def close(self): """Finish writing.""" self.image_writer.close() + if self.depth_writer is not None: + self.depth_writer.close()