From 6c0ae5796951d234bf85c32549b391cce14da831 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Mu=CC=88ller-Ho=CC=88hne?= <thomas94@gmx.net> Date: Thu, 12 Jan 2023 08:44:22 +0100 Subject: [PATCH] Add `--overwrite` option to silence colmap2nerf.py warnings --- scripts/colmap2nerf.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/colmap2nerf.py b/scripts/colmap2nerf.py index 252ef3e..d61b672 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) -- GitLab