def merge(self, ptos): '''Return a project containing both control points''' ''' Does not allow in place replace, we have to move things around [mcmaster@gespenst bin]$ pto_merge --help pto_merge: merges several project files pto_merge version 2010.4.0.854952d82c8f Usage: pto_merge [options] input.pto input2.pto ... Options: -o, --output=file.pto Output Hugin PTO file. Default: <filename>_merge.pto -h, --help Shows this help ''' if len(ptos) == 0: print 'WARNING: skipping merge due to no other files' raise Exception('Nothing to merge') return None this = [] if self.file_name and os.path.exists(self.file_name): this = [self] # Merge is based on filename # Must be synced to disk self.save() m = Merger(this + ptos) return m.run()
def merge(self, others): '''Return a project containing both control points''' ''' Does not allow in place replace, we have to move things around [mcmaster@gespenst bin]$ pto_merge --help pto_merge: merges several project files pto_merge version 2010.4.0.854952d82c8f Usage: pto_merge [options] input.pto input2.pto ... Options: -o, --output=file.pto Output Hugin PTO file. Default: <filename>_merge.pto -h, --help Shows this help ''' if len(others) == 0: print 'WARNING: skipping merge due to no other files' raise Exception('Nothing to merge') return None # Make sure that current project gets included # if empty we should still do this so that a merge can happen # as "merging" causes panotools project transforms tools may expect self.save() m = Merger(others) m.pto = self return m.run()
def resave_hugin(pto): from pr0ntools.stitch.merger import Merger from pr0ntools.stitch.pto.project import PTOProject # pto_merge -o converted.pto out.pto out.pto blank = PTOProject.from_blank() m = Merger([blank]) m.pto = pto new = m.run(to_pto=True) if new != pto: raise Exception('Expected self merge') dbg('Merge into self')
def resave_hugin(pto): from pr0ntools.stitch.merger import Merger from pr0ntools.stitch.pto.project import PTOProject # pto_merge -o converted.pto out.pto out.pto blank = PTOProject.from_blank() m = Merger([blank]) m.pto = pto new = m.run(to_pto=True) if new != pto: raise Exception('Expected self merge') print 'Merge into self'
def merge_into(self, ptos): '''Merge project into this one. Output file is updated''' print 'merge_into: others: %d' % len(ptos) this = [] if self.file_name and os.path.exists(self.file_name): this = [self] # Merge is based on filename # Must be synced to disk self.save() # Merging modifies the project structure so make sure that a dummy merge occurs if nothing else m = Merger(this + ptos) temp = m.run() shutil.move(temp.file_name, self.file_name) self.reopen()