本文整理汇总了Python中pr0ntools.stitch.pto.project.PTOProject.from_file_name方法的典型用法代码示例。如果您正苦于以下问题:Python PTOProject.from_file_name方法的具体用法?Python PTOProject.from_file_name怎么用?Python PTOProject.from_file_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pr0ntools.stitch.pto.project.PTOProject
的用法示例。
在下文中一共展示了PTOProject.from_file_name方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_multi
# 需要导入模块: from pr0ntools.stitch.pto.project import PTOProject [as 别名]
# 或者: from pr0ntools.stitch.pto.project.PTOProject import from_file_name [as 别名]
def test_multi(self):
print 'Multi test'
project = PTOProject.from_file_name('in.pto')
remapper = Remapper(project)
remapper.image_type = Remapper.TIFF_SINGLE
remapper.run()
self.clean()
示例2: test_center_anchor
# 需要导入模块: from pr0ntools.stitch.pto.project import PTOProject [as 别名]
# 或者: from pr0ntools.stitch.pto.project.PTOProject import from_file_name [as 别名]
def test_center_anchor(self):
project = PTOProject.from_file_name('in.pto')
center_anchor(project)
'''
Image 4 at (1, 1) is the correct answer
'''
#vl = project.get_variable_lines()[4]
project.save()
示例3: test_optimize
# 需要导入模块: from pr0ntools.stitch.pto.project import PTOProject [as 别名]
# 或者: from pr0ntools.stitch.pto.project.PTOProject import from_file_name [as 别名]
def test_optimize(self):
print 'Loading raw project...'
project = PTOProject.from_file_name('in.pto')
print 'Creating optimizer...'
optimizer = PTOptimizer(project)
#self.assertTrue(project.text != None)
print 'Running optimizer...'
optimizer.run()
示例4: usage
# 需要导入模块: from pr0ntools.stitch.pto.project import PTOProject [as 别名]
# 或者: from pr0ntools.stitch.pto.project.PTOProject import from_file_name [as 别名]
def usage():
print 'optimizer <file in> [file out]'
print 'If file out is not given it will be file in'
if __name__ == "__main__":
from pr0ntools.stitch.pto.project import PTOProject
if len(sys.argv) < 2:
usage()
sys.exit(1)
file_name_in = sys.argv[1]
if len(sys.argv) > 2:
file_name_out = sys.argv[2]
else:
file_name_out = file_name_in
print 'Loading raw project...'
project = PTOProject.from_file_name(file_name_in)
print 'Creating optimizer...'
optimizer = PTOptimizer(project)
#self.assertTrue(project.text != None)
print 'Running optimizer...'
print 'Parsed main pre-run: %s' % str(project.parsed)
optimizer.run()
print 'Parsed main: %d' % project.parsed
print 'Saving...'
project.save_as(file_name_out)
print 'Parsed main done: %s' % str(project.parsed)
示例5: help
# 需要导入模块: from pr0ntools.stitch.pto.project import PTOProject [as 别名]
# 或者: from pr0ntools.stitch.pto.project.PTOProject import from_file_name [as 别名]
arg_key = arg[2:]
if arg_key == "help":
help()
sys.exit(0)
else:
arg_fatal('Unrecognized arg: %s' % arg)
else:
if arg.find('.pto') > 0:
project_file_names.append(arg)
elif os.path.isfile(arg) or os.path.isdir(arg):
image_file_names.append(arg)
else:
arg_fatal('unrecognized arg: %s' % arg)
project = PTOProject.from_file_name('panorama0.pto')
project.parse()
calc_centroid()
sys.exit(1)
project.regen()
print
print
print
print project.get_text()
#project.save_as('out_reparsed.pto')
print
print
print
示例6: test_center
# 需要导入模块: from pr0ntools.stitch.pto.project import PTOProject [as 别名]
# 或者: from pr0ntools.stitch.pto.project.PTOProject import from_file_name [as 别名]
def test_center(self):
project = PTOProject.from_file_name('in.pto')
center(project)
(ybar, xbar) = calc_center(project)
print 'Final xbar %f, ybar %f' % (ybar, xbar)
project.save()
示例7: Exception
# 需要导入模块: from pr0ntools.stitch.pto.project import PTOProject [as 别名]
# 或者: from pr0ntools.stitch.pto.project.PTOProject import from_file_name [as 别名]
args = parser.parse_args()
if args.threads < 1:
raise Exception('Bad threads')
print 'Using %d threads' % args.threads
log_dir = args.log
out_dir = 'out'
_dt = logwt(log_dir, 'main.log', shift_d=True)
fn = args.pto[0]
auto_size = not (args.stp or args.stm or args.stw or args.sth)
print 'Assuming input %s is pto project to be stitched' % args.pto
project = PTOProject.from_file_name(args.pto)
print 'Creating tiler'
stp = None
if args.stp:
stp = mksize(args.stp)
elif args.stm:
stp = mem2pix(mksize(args.stm))
print 'Memory %s => %s pix' % (args.stm, size2str(stp))
elif auto_size:
stm = config.super_tile_memory()
if stm:
stp = mem2pix(mksize(stm))
# having issues creating very large
if stp > 2**32/4:
# 66 GB max useful as currently written
print 'WARNING: reducing to maximum tile size'
示例8: test_optimize_conversion
# 需要导入模块: from pr0ntools.stitch.pto.project import PTOProject [as 别名]
# 或者: from pr0ntools.stitch.pto.project.PTOProject import from_file_name [as 别名]
def test_optimize_conversion(self):
project = PTOProject.from_file_name('in.pto')
pt = project.copy()
示例9: test_load
# 需要导入模块: from pr0ntools.stitch.pto.project import PTOProject [as 别名]
# 或者: from pr0ntools.stitch.pto.project.PTOProject import from_file_name [as 别名]
def test_load(self):
project = PTOProject.from_file_name('in.pto')
#self.assertTrue(project.text != None)
self.assertEqual(len(project.image_lines), 4)
示例10: help
# 需要导入模块: from pr0ntools.stitch.pto.project import PTOProject [as 别名]
# 或者: from pr0ntools.stitch.pto.project.PTOProject import from_file_name [as 别名]
arg_key = arg[2:]
if arg_key == "help":
help()
sys.exit(0)
else:
arg_fatal('Unrecognized arg: %s' % arg)
else:
if arg.find('.pto') > 0:
project_file_names.append(arg)
elif os.path.isfile(arg) or os.path.isdir(arg):
image_file_names.append(arg)
else:
arg_fatal('unrecognized arg: %s' % arg)
project = PTOProject.from_file_name('out.pto')
project.parse()
# Overall exposure
# *very* important
project.panorama_line.set_variable('E', 1)
# What about m's p and s?
for image_line in project.image_lines:
# Don't adjust exposure
image_line.set_variable('Eev', 1)
# blue and red white balance correction at normal levels
image_line.set_variable('Eb', 1)
image_line.set_variable('Er', 1)
示例11: int
# 需要导入模块: from pr0ntools.stitch.pto.project import PTOProject [as 别名]
# 或者: from pr0ntools.stitch.pto.project.PTOProject import from_file_name [as 别名]
'''
import argparse
from pr0ntools.stitch.pto.project import PTOProject
from pr0ntools.stitch.image_coordinate_map import ImageCoordinateMap
import subprocess
import shutil
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='create tiles from unstitched images')
parser.add_argument('--border', default='1', help='border size')
parser.add_argument('pto', default='out.pto', nargs='?', help='pto project')
args = parser.parse_args()
args.border = int(args.border, 0)
pto_orig = PTOProject.from_file_name(args.pto)
img_fns = []
for il in pto_orig.get_image_lines():
img_fns.append(il.get_name())
icm = ImageCoordinateMap.from_tagged_file_names(img_fns)
# Reduced .pto
pto_red = pto_orig.copy()
# Delete all lines not in the peripheral
pto_orig.build_image_fn_map()
ils_del = []
for y in xrange(args.border, icm.height() - args.border):
for x in xrange(args.border, icm.width() - args.border):
im = icm.get_image(x, y)
if im is None:
continue
示例12: help
# 需要导入模块: from pr0ntools.stitch.pto.project import PTOProject [as 别名]
# 或者: from pr0ntools.stitch.pto.project.PTOProject import from_file_name [as 别名]
arg_key = arg[2:]
if arg_key == "help":
help()
sys.exit(0)
else:
arg_fatal("Unrecognized arg: %s" % arg)
else:
if arg.find(".pto") > 0:
project_file_names.append(arg)
elif os.path.isfile(arg) or os.path.isdir(arg):
image_file_names.append(arg)
else:
arg_fatal("unrecognized arg: %s" % arg)
project = PTOProject.from_file_name("out.pto")
project.parse()
reset_photometrics = True
if reset_photometrics:
# Overall exposure
# *very* important
project.panorama_line.set_variable("E", 1)
# What about m's p and s?
for image_line in project.image_lines:
# Don't adjust exposure
image_line.set_variable("Eev", 1)
# blue and red white balance correction at normal levels
image_line.set_variable("Eb", 1)
image_line.set_variable("Er", 1)
示例13: system
# 需要导入模块: from pr0ntools.stitch.pto.project import PTOProject [as 别名]
# 或者: from pr0ntools.stitch.pto.project.PTOProject import from_file_name [as 别名]
help='project to use for creating linear system (default: in)')
parser.add_argument('--allow-missing', action="store_true", dest="allow_missing", default=False, help='Allow missing images')
parser.add_argument('pto', metavar='.pto in', type=str, nargs=1,
help='project to work on')
parser.add_argument('out', metavar='.pto out', type=str, nargs='?',
help='output file, default to override input')
args = parser.parse_args()
pto_in = args.pto[0]
pto_out = args.out
if pto_out is None:
pto_out = pto_in
print 'In: %s' % pto_in
print 'Out: %s' % pto_out
pto = PTOProject.from_file_name(pto_in)
# Make sure we don't accidently override the original
pto.remove_file_name()
if args.center is True:
center(pto)
if args.anchor:
print 'Re-finding anchor'
center_anchor(pto)
if args.basename:
print 'Converting to basename'
make_basename(pto)
if args.hugin:
示例14: name
# 需要导入模块: from pr0ntools.stitch.pto.project import PTOProject [as 别名]
# 或者: from pr0ntools.stitch.pto.project.PTOProject import from_file_name [as 别名]
help='output file name (default: out.pto)')
parser.add_argument('--allow-missing', action="store_true", dest="allow_missing", default=True, help='Allow missing images')
parser.add_argument('--border', action="store_true", dest="border", default=False, help='Manually optimize border')
args = parser.parse_args()
pto_ref_fn = args.pto_ref[0]
pto_out_fn = args.pto_out
print 'Reference in: %s' % pto_ref_fn
print 'Out: %s' % pto_out_fn
# Have to start somewhere...
pto_out = PTOProject.from_default()
# Add the images in
for image in args.images:
pto_out.add_image(image)
pto_ref = PTOProject.from_file_name(pto_ref_fn)
pto_ref.remove_file_name()
linear_reoptimize(pto_out, pto_ref, allow_missing=args.allow_missing, order=2, border=args.border)
print 'Centering...'
center(pto_out)
print 'Converting to Hugin form...'
resave_hugin(pto_out)
print 'Saving to %s' % pto_out_fn
pto_out.save_as(pto_out_fn)