def test_tile_real(self): project = PTOProject.parse_from_file_name('in.pto') print 'Creating tiler' t = Tiler(project, 'out', st_scalar_heuristic=2) self.assertEqual(len(list(t.gen_supertiles())), 4) print 'Unit test running tiler (real)' t.run()
def test_multi(self): print 'Multi test' project = PTOProject.parse_from_file_name('in.pto') remapper = Remapper(project) remapper.image_type = Remapper.TIFF_SINGLE remapper.run() self.clean()
def test_tile_dry(self): ''' Inputs are 1632 x 1224 a 3 x 3 grid allows testing edge boundary conditions as well as internal The reference fully stitched image is 3377 x 2581 ''' project = PTOProject.parse_from_file_name('in.pto') print 'Creating tiler' t = Tiler(project, 'out', st_scalar_heuristic=2) #iw = 1632 #ih = 1224 #t.set_size_heuristic(iw, ih) ''' Should make 4 tiles with 3 X 3 ''' #t.super_tw = 2 * iw #t.super_th = 2 * ih ''' Each supertile should cover two images as setup There will be some overlap in the center and unique area on all four edges ''' self.assertEqual(len(list(t.gen_supertiles())), 4) print 'Unit test running tiler (real)' t.dry = True t.run()
def test_center_anchor(self): project = PTOProject.parse_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()
def test_optimize(self): print 'Loading raw project...' project = PTOProject.parse_from_file_name('in.pto') print 'Creating optimizer...' optimizer = PTOptimizer(project) #self.assertTrue(project.text != None) print 'Running optimizer...' optimizer.run()
def test_center(self): project = PTOProject.parse_from_file_name('in.pto') center(project) (ybar, xbar) = calc_center(project) print 'Final xbar %f, ybar %f' % (ybar, xbar) project.save()
def test_optimize_conversion(self): project = PTOProject.parse_from_file_name('in.pto') pt = project.to_ptoptimizer()
def test_load(self): project = PTOProject.parse_from_file_name('in.pto') #self.assertTrue(project.text != None) self.assertEqual(len(project.image_lines), 4)
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.parse_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)