From 39ced986d6eec9321a0e8666ed7010eb70569820 Mon Sep 17 00:00:00 2001 From: Mason Date: Mon, 7 Dec 2020 22:54:58 +0900 Subject: [PATCH] Compatible for windows system (#29) Compatibility for Windows: handle paths and globs properly. Co-authored-by: mason.suh --- hloc/extract_features.py | 3 ++- hloc/triangulation.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/hloc/extract_features.py b/hloc/extract_features.py index 39d78ded..dbe1b0a0 100644 --- a/hloc/extract_features.py +++ b/hloc/extract_features.py @@ -76,6 +76,7 @@ def __init__(self, root, conf): self.paths += list(Path(root).glob('**/'+g)) if len(self.paths) == 0: raise ValueError(f'Could not find any image in root: {root}.') + self.paths = sorted(list(set(self.paths))) self.paths = [i.relative_to(root) for i in self.paths] logging.info(f'Found {len(self.paths)} images in root {root}.') @@ -107,7 +108,7 @@ def __getitem__(self, idx): image = image / 255. data = { - 'name': str(path), + 'name': path.as_posix(), 'image': image, 'original_size': np.array(size), } diff --git a/hloc/triangulation.py b/hloc/triangulation.py index 8812f62b..737e92a8 100644 --- a/hloc/triangulation.py +++ b/hloc/triangulation.py @@ -128,7 +128,7 @@ def run_triangulation(colmap_path, model_path, database_path, image_dir, exit(ret) stats_raw = subprocess.check_output( - [str(colmap_path), 'model_analyzer', '--path', model_path]) + [str(colmap_path), 'model_analyzer', '--path', str(model_path)]) stats_raw = stats_raw.decode().split("\n") stats = dict() for stat in stats_raw: