Browse Source

Clearer conversion explanation

bkerbl 2 năm trước cách đây
mục cha
commit
c1b61aad15
2 tập tin đã thay đổi với 81 bổ sung33 xóa
  1. 59 13
      README.md
  2. 22 20
      convert.py

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 59 - 13
README.md


+ 22 - 20
convert.py

@@ -16,6 +16,7 @@ import shutil
 # This Python script is based on the shell converter script provided in the MipNerF 360 repository.
 parser = ArgumentParser("Colmap converter")
 parser.add_argument("--no_gpu", action='store_true')
+parser.add_argument("--skip_matching", action='store_true')
 parser.add_argument("--source_path", "-s", required=True, type=str)
 parser.add_argument("--camera", default="OPENCV", type=str)
 parser.add_argument("--colmap_executable", default="", type=str)
@@ -26,29 +27,30 @@ colmap_command = '"{}"'.format(args.colmap_executable) if len(args.colmap_execut
 magick_command = '"{}"'.format(args.magick_executable) if len(args.magick_executable) > 0 else "magick"
 use_gpu = 1 if not args.no_gpu else 0
 
-os.makedirs(args.source_path + "/distorted/sparse", exist_ok=True)
+if not args.skip_matching:
+    os.makedirs(args.source_path + "/distorted/sparse", exist_ok=True)
 
-## Feature extraction
-os.system(colmap_command + " feature_extractor "\
-    "--database_path " + args.source_path + "/distorted/database.db \
-    --image_path " + args.source_path + "/input \
-    --ImageReader.single_camera 1 \
-    --ImageReader.camera_model " + args.camera + " \
-    --SiftExtraction.use_gpu " + str(use_gpu))
+    ## Feature extraction
+    os.system(colmap_command + " feature_extractor "\
+        "--database_path " + args.source_path + "/distorted/database.db \
+        --image_path " + args.source_path + "/input \
+        --ImageReader.single_camera 1 \
+        --ImageReader.camera_model " + args.camera + " \
+        --SiftExtraction.use_gpu " + str(use_gpu))
 
-## Feature matching
-os.system(colmap_command + " exhaustive_matcher \
-    --database_path " + args.source_path + "/distorted/database.db \
-    --SiftMatching.use_gpu " + str(use_gpu))
+    ## Feature matching
+    os.system(colmap_command + " exhaustive_matcher \
+        --database_path " + args.source_path + "/distorted/database.db \
+        --SiftMatching.use_gpu " + str(use_gpu))
 
-### Bundle adjustment
-# The default Mapper tolerance is unnecessarily large,
-# decreasing it speeds up bundle adjustment steps.
-os.system(colmap_command + " mapper \
-    --database_path " + args.source_path + "/distorted/database.db \
-    --image_path "  + args.source_path + "/input \
-    --output_path "  + args.source_path + "/distorted/sparse \
-    --Mapper.ba_global_function_tolerance=0.000001")
+    ### Bundle adjustment
+    # The default Mapper tolerance is unnecessarily large,
+    # decreasing it speeds up bundle adjustment steps.
+    os.system(colmap_command + " mapper \
+        --database_path " + args.source_path + "/distorted/database.db \
+        --image_path "  + args.source_path + "/input \
+        --output_path "  + args.source_path + "/distorted/sparse \
+        --Mapper.ba_global_function_tolerance=0.000001")
 
 ### Image undistortion
 ## We need to undistort our images into ideal pinhole intrinsics.