Skip to content

Commit 19c6c32

Browse files
committed
misc
1 parent 6d9e39e commit 19c6c32

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

examples/datasets/colmap.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,14 @@ def __init__(
161161

162162
# Downsampled images may have different names vs images used for COLMAP,
163163
# so we need to map between the two sorted lists of files.
164-
colmap_files = sorted(_get_rel_paths(colmap_image_dir))
165-
image_files = sorted(_get_rel_paths(image_dir))
164+
if os.path.exists(os.path.join(data_dir, "masks")): # Temporal warkaround on New Dataset, use Mask dir to verify
165+
import re
166+
colmap_files = sorted(_get_rel_paths(colmap_image_dir), key=lambda x: int(re.search(r'cam_(\d+)_', x).group(1)))
167+
image_files = sorted(_get_rel_paths(image_dir), key=lambda x: int(re.search(r'cam_(\d+)_', x).group(1)))
168+
else:
169+
colmap_files = sorted(_get_rel_paths(colmap_image_dir))
170+
image_files = sorted(_get_rel_paths(image_dir))
171+
166172
colmap_to_image = dict(zip(colmap_files, image_files))
167173
image_paths = [os.path.join(image_dir, colmap_to_image[f]) for f in image_names]
168174

0 commit comments

Comments
 (0)