-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathfeature_aj.py
executable file
·63 lines (53 loc) · 1.87 KB
/
feature_aj.py
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/env python3
'''
pr0nstitchaj: AJ's autopano WINE wrapper for Hugin
Copyright 2011 John McMaster <[email protected]>
Licensed under a 2 clause BSD license, see COPYING for details
'''
from xystitch.pto.project import PTOProject
import sys
import os.path
import argparse
from xystitch.all_stitch import AllStitch
def arg_fatal(s):
print(s)
help()
sys.exit(1)
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="create Hugin .pto using Andrew Jenny's autopano")
#parser.add_argument('pto', metavar='pto project', type=str, nargs=1, help='pto project')
parser.add_argument('--verbose',
'-v',
action="store_true",
default=False,
help='spew lots of info')
parser.add_argument('--overwrite',
action="store_true",
default=False,
help='overwrite existing output file')
parser.add_argument('--dry',
action="store_true",
default=False,
help='dont actually stitch')
parser.add_argument('files', nargs='+', help='a .pto and some image files')
args = parser.parse_args()
pto_fn = "out.pto"
image_fns = []
for fn in args.files:
print(fn)
if fn.find(".pto") >= 0:
pto_fn = fn
else:
image_fns.append(fn)
if len(image_fns) < 2:
raise Exception('Need at least two images to stitch')
engine = AllStitch.from_file_names(image_fns)
engine.set_output_project_file_name(pto_fn)
engine.set_dry(args.dry)
if not args.overwrite:
if pto_fn and os.path.exists(pto_fn):
print('ERROR: cannot overwrite existing project file: %s' % pto_fn)
sys.exit(1)
engine.run()
print('Done!')