Skip to content
Snippets Groups Projects
Commit 6c0ae579 authored by Thomas Müller-Höhne's avatar Thomas Müller-Höhne
Browse files

Add `--overwrite` option to silence colmap2nerf.py warnings

parent 6c06f0bc
No related branches found
No related tags found
No related merge requests found
...@@ -42,6 +42,7 @@ def parse_args(): ...@@ -42,6 +42,7 @@ def parse_args():
parser.add_argument("--keep_colmap_coords", action="store_true", help="Keep transforms.json in COLMAP's original frame of reference (this will avoid reorienting and repositioning the scene for preview and rendering).") parser.add_argument("--keep_colmap_coords", action="store_true", help="Keep transforms.json in COLMAP's original frame of reference (this will avoid reorienting and repositioning the scene for preview and rendering).")
parser.add_argument("--out", default="transforms.json", help="Output path.") parser.add_argument("--out", default="transforms.json", help="Output path.")
parser.add_argument("--vocab_path", default="", help="Vocabulary tree path.") parser.add_argument("--vocab_path", default="", help="Vocabulary tree path.")
parser.add_argument("--overwrite", action="store_true", help="Do not ask for confirmation for overwriting existing images and COLMAP data.")
args = parser.parse_args() args = parser.parse_args()
return args return args
...@@ -74,7 +75,7 @@ def run_ffmpeg(args): ...@@ -74,7 +75,7 @@ def run_ffmpeg(args):
video = "\"" + args.video_in + "\"" video = "\"" + args.video_in + "\""
fps = float(args.video_fps) or 1.0 fps = float(args.video_fps) or 1.0
print(f"running ffmpeg with input video file={video}, output image folder={images}, fps={fps}.") print(f"running ffmpeg with input video file={video}, output image folder={images}, fps={fps}.")
if (input(f"warning! folder '{images}' will be deleted/replaced. continue? (Y/n)").lower().strip()+"y")[:1] != "y": if not args.overwrite and (input(f"warning! folder '{images}' will be deleted/replaced. continue? (Y/n)").lower().strip()+"y")[:1] != "y":
sys.exit(1) sys.exit(1)
try: try:
# Passing Images' Path Without Double Quotes # Passing Images' Path Without Double Quotes
...@@ -114,7 +115,7 @@ def run_colmap(args): ...@@ -114,7 +115,7 @@ def run_colmap(args):
text=args.text text=args.text
sparse=db_noext+"_sparse" sparse=db_noext+"_sparse"
print(f"running colmap with:\n\tdb={db}\n\timages={images}\n\tsparse={sparse}\n\ttext={text}") print(f"running colmap with:\n\tdb={db}\n\timages={images}\n\tsparse={sparse}\n\ttext={text}")
if (input(f"warning! folders '{sparse}' and '{text}' will be deleted/replaced. continue? (Y/n)").lower().strip()+"y")[:1] != "y": if not args.overwrite and (input(f"warning! folders '{sparse}' and '{text}' will be deleted/replaced. continue? (Y/n)").lower().strip()+"y")[:1] != "y":
sys.exit(1) sys.exit(1)
if os.path.exists(db): if os.path.exists(db):
os.remove(db) os.remove(db)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment