1qwsd commited on
Commit
6f3db80
Β·
verified Β·
1 Parent(s): 0e9f527

ci: auto-deploy from GitHub Actions

Browse files
Files changed (1) hide show
  1. pipeline/colmap_runner.py +8 -9
pipeline/colmap_runner.py CHANGED
@@ -65,14 +65,15 @@ def run_colmap(image_dir: str, output_dir: str = None) -> str:
65
  # 3. `--ImageReader.single_camera 1` shares the same camera parameters across
66
  # all video frames (since they come from the same physical camera/sensor).
67
  # This prevents independent camera calibration drift and solves registration errors.
68
- # 4. `--ImageReader.camera_model SIMPLE_RADIAL` is highly stable for consumer cameras
69
- # and prevents parameter estimation failures compared to the 8-parameter OPENCV model.
 
70
  print("Step 1: Feature extraction (Optimized)...")
71
  subprocess.run([
72
  settings.COLMAP_PATH, "feature_extractor",
73
  "--image_path", image_dir,
74
  "--database_path", database_path,
75
- "--ImageReader.camera_model", "SIMPLE_RADIAL",
76
  "--ImageReader.single_camera", "1",
77
  "--SiftExtraction.use_gpu", gpu_param,
78
  "--SiftExtraction.first_octave", "0", # Disable upscaling for 3-5x speedup
@@ -109,17 +110,15 @@ def run_colmap(image_dir: str, output_dir: str = None) -> str:
109
  subprocess.run(matcher_cmd, check=True)
110
 
111
  # ── Step 3: Sparse reconstruction ───────────────────────────────────────
112
- print("Step 3: Sparse reconstruction (High Resiliency)...")
 
 
 
113
  subprocess.run([
114
  settings.COLMAP_PATH, "mapper",
115
  "--database_path", database_path,
116
  "--image_path", image_dir,
117
  "--output_path", output_dir,
118
- "--Mapper.init_min_tri_angle", "4.0", # Handles low-parallax camera moves
119
- "--Mapper.init_min_num_inliers", "30", # Initializes with fewer features
120
- "--Mapper.init_max_reg_trials", "300", # Searches harder for starting pairs
121
- "--Mapper.abs_pose_min_num_inliers", "15", # Registers hard-to-match frames
122
- "--Mapper.filter_max_reproj_error", "6.0", # Tolerates minor lens distortion & noise
123
  ], check=True)
124
 
125
  return os.path.join(output_dir, "0")
 
65
  # 3. `--ImageReader.single_camera 1` shares the same camera parameters across
66
  # all video frames (since they come from the same physical camera/sensor).
67
  # This prevents independent camera calibration drift and solves registration errors.
68
+ # 4. `--ImageReader.camera_model SIMPLE_PINHOLE` is used because smartphone video
69
+ # frames are already distortion-corrected by the phone software. Using a pinhole
70
+ # model prevents distortion parameter estimation from diverging during GBA.
71
  print("Step 1: Feature extraction (Optimized)...")
72
  subprocess.run([
73
  settings.COLMAP_PATH, "feature_extractor",
74
  "--image_path", image_dir,
75
  "--database_path", database_path,
76
+ "--ImageReader.camera_model", "SIMPLE_PINHOLE",
77
  "--ImageReader.single_camera", "1",
78
  "--SiftExtraction.use_gpu", gpu_param,
79
  "--SiftExtraction.first_octave", "0", # Disable upscaling for 3-5x speedup
 
110
  subprocess.run(matcher_cmd, check=True)
111
 
112
  # ── Step 3: Sparse reconstruction ───────────────────────────────────────
113
+ # We use COLMAP's default mapper parameters because they are highly tuned
114
+ # for geometric stability. Custom thresholds (like loose reprojection limits)
115
+ # can introduce noise that corrupts shared camera intrinsics, leading to loop failures.
116
+ print("Step 3: Sparse reconstruction (Standard Defaults)...")
117
  subprocess.run([
118
  settings.COLMAP_PATH, "mapper",
119
  "--database_path", database_path,
120
  "--image_path", image_dir,
121
  "--output_path", output_dir,
 
 
 
 
 
122
  ], check=True)
123
 
124
  return os.path.join(output_dir, "0")