Support COLMAP reconstructions with non-flat image dirs (#3006)

* Support COLMAP reconstructions with nested image dirs

The code was previously looking for the file.name, which drops all
directory information from the path. Instead, we want to get the file
path relative to the data dir, which will only drop parts of the path
above the data dir, allowing us to recurse into subdirectories within
the images dir

* Adhere to style guidelines

* Add testcase to cover image dirs with subdirs
This commit is contained in:
Zac Stewart authored and GitHub committed 2024-04-02 14:17:17 -04:00
1 parent a990721fa8
commit 1b9dfe8bb3
3 files changed
+91 -2

No files matched your search

@@ -87,7 +87,9 @@ class ImagesToNerfstudioDataset(ColmapConverterToNerfstudioDataset):
)
image_rename_map_paths.update(eval_image_rename_map_paths)
image_rename_map = dict((a.name, b.name) for a, b in image_rename_map_paths.items())
image_rename_map = dict(
(a.relative_to(self.data).as_posix(), b.name) for a, b in image_rename_map_paths.items()
)
num_frames = len(image_rename_map)
summary_log.append(f"Starting with {num_frames} images")
@@ -62,7 +62,7 @@ CAMERA_MODELS = {
}
def list_images(data: Path, recursive: bool = False) -> List[Path]:
def list_images(data: Path, recursive: bool = True) -> List[Path]:
"""Lists all supported images in a directory
Args: