Repository navigation
Expand file tree
/
Copy pathreconstruct.py
More file actions
39 lines (35 loc) · 1.6 KB
/
Copy pathreconstruct.py
File metadata and controls
39 lines (35 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import argparse
from pathlib import Path
from mpsfm.test.simple import SimpleTest
from mpsfm.utils.tools import load_cfg
from mpsfm.vars import gvars
parser = argparse.ArgumentParser()
parser.add_argument(
"--data_dir", type=str, default="local/example", help="Main data dir storing inputs and later the outputs"
)
parser.add_argument("--images_dir", type=str, help="Images directory")
parser.add_argument(
"--imnames", type=str, nargs="*", help="List of image names to process. Leave empty to process all images"
)
parser.add_argument("--intrinsics_pth", type=str, default=None, help="Path to intrinsics .yaml file")
parser.add_argument("--refrec_dir", type=str, default=None, help="Path to reference reconstruction")
parser.add_argument("--cache_dir", type=str, default=None, help="Path to cache directory")
parser.add_argument("-e", "--extract", nargs="*", type=str, default=[], help="List of priors to force reextract")
parser.add_argument("-c", "--conf", type=str, help="Name of the sfm config file", default="sp-lg_m3dv2")
parser.add_argument("-v", "--verbose", type=int, default=0)
args, _ = parser.parse_known_args()
conf = load_cfg(gvars.SFM_CONFIG_DIR / f"{args.conf}.yaml", return_name=False)
conf.extract = args.extract
conf.verbose = args.verbose
experiment = SimpleTest(conf)
mpsfm_rec = experiment(
imnames=args.imnames,
intrinsics_pth=args.intrinsics_pth,
refrec_dir=args.refrec_dir,
cache_dir=args.cache_dir,
data_dir=args.data_dir,
images_dir=args.images_dir,
)
sfm_outputs_dir = Path(args.data_dir) / "sfm_outputs"
sfm_outputs_dir.mkdir(exist_ok=True)
mpsfm_rec.write(sfm_outputs_dir)