This commit is contained in:
bjoernellens1 authored and GitHub committed 2026-08-11 11:07:14 +02:00
commit bb7eb4c2d5
1 file changed
+8 -2
+8 -2
View File
@@ -115,6 +115,12 @@ def run_colmap(
""" """
colmap_version = get_colmap_version(colmap_cmd) colmap_version = get_colmap_version(colmap_cmd)
# COLMAP's #3465 (released in 3.13.0) renamed the use_gpu/gpu_index options from
# SiftExtraction/SiftMatching to FeatureExtraction/FeatureMatching as part of
# generalizing feature extraction beyond SIFT; the old names were dropped, not kept
# as aliases, so this must be version-gated rather than always using one or the other.
use_gpu_extraction_prefix = "FeatureExtraction" if colmap_version >= Version("3.13") else "SiftExtraction"
use_gpu_matching_prefix = "FeatureMatching" if colmap_version >= Version("3.13") else "SiftMatching"
colmap_database_path = colmap_dir / "database.db" colmap_database_path = colmap_dir / "database.db"
colmap_database_path.unlink(missing_ok=True) colmap_database_path.unlink(missing_ok=True)
@@ -126,7 +132,7 @@ def run_colmap(
f"--image_path {image_dir}", f"--image_path {image_dir}",
"--ImageReader.single_camera 1", "--ImageReader.single_camera 1",
f"--ImageReader.camera_model {camera_model.value}", f"--ImageReader.camera_model {camera_model.value}",
f"--SiftExtraction.use_gpu {int(gpu)}", f"--{use_gpu_extraction_prefix}.use_gpu {int(gpu)}",
] ]
if camera_mask_path is not None: if camera_mask_path is not None:
feature_extractor_cmd.append(f"--ImageReader.camera_mask_path {camera_mask_path}") feature_extractor_cmd.append(f"--ImageReader.camera_mask_path {camera_mask_path}")
@@ -140,7 +146,7 @@ def run_colmap(
feature_matcher_cmd = [ feature_matcher_cmd = [
f"{colmap_cmd} {matching_method}_matcher", f"{colmap_cmd} {matching_method}_matcher",
f"--database_path {colmap_dir / 'database.db'}", f"--database_path {colmap_dir / 'database.db'}",
f"--SiftMatching.use_gpu {int(gpu)}", f"--{use_gpu_matching_prefix}.use_gpu {int(gpu)}",
] ]
if matching_method == "vocab_tree": if matching_method == "vocab_tree":
vocab_tree_filename = get_vocab_tree() vocab_tree_filename = get_vocab_tree()