diff --git a/scripts/colmap2nerf.py b/scripts/colmap2nerf.py index 252ef3e64510b99616c1ae2a258117098724ccc7..d61b67208f00f30fc2fb774471c771a94bc6e598 100755 --- a/scripts/colmap2nerf.py +++ b/scripts/colmap2nerf.py @@ -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("--out", default="transforms.json", help="Output 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() return args @@ -74,7 +75,7 @@ def run_ffmpeg(args): video = "\"" + args.video_in + "\"" fps = float(args.video_fps) or 1.0 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) try: # Passing Images' Path Without Double Quotes @@ -114,7 +115,7 @@ def run_colmap(args): text=args.text sparse=db_noext+"_sparse" 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) if os.path.exists(db): os.remove(db)