def start_btn_cb(self): if self.errors(): exit() img_h = int(self.img_h.get()) img_w = int(self.img_w.get()) tile_val = int(self.tile_size.get()) dis_metric = self.hist_var.get() filename = self.image_path[self.image_path.rfind("/") + 1:-4] filename_out = filename + time.strftime("%Y%m%d-%H-%M-%S") + \ "-" + dis_metric + "-" + str(tile_val) + "-" + \ str(img_w) + "x" + str(img_h) mos = Mosaic(self.image_path, (img_w, img_h), tile_val, dis_metric, filename_out) if self.part_chooser.get() == "A": if self.src_dir is None: print("Select source directory") exit() mos.read_src_images(self.src_dir) mos.create_mosaic(self.src_dir) elif self.part_chooser.get() == "C": dir = mos.classify_img() mos.read_src_images(dir) mos.create_mosaic(dir)
class mosaicTestCase(unittest.TestCase): """Test cases for EnhancedMosaic.""" def setUp(self): """Set up.""" self.mosaic = Mosaic('./dali') def tearDown(self): """Clean up.""" self.mosaic = None def testCreateMosaic(self): """Test creating a fractal mosaic.""" self.mosaic.create_mosaic('./karan.jpg', MIN_SIZE) self.mosaic.save_as('./output.jpeg')
def start_btn_cb(self): if self.errors(): exit() img_h = int(self.img_h.get()) img_w = int(self.img_w.get()) tile_val = int(self.tile_size.get()) dis_metric = self.hist_var.get() filename = self.image_path[self.image_path.rfind("/") + 1:-4] filename_out = filename + time.strftime( "%Y%m%d-%H-%M-%S") + "-" + dis_metric + "-" + str( tile_val) + "-" + str(img_w) + "x" + str(img_h) mos = Mosaic(self.image_path, (img_w, img_h), tile_val, self.src_dir, dis_metric, filename_out) if self.part_chooser.get() == "A": mos.read_src_images() mos.create_mosaic() elif self.part_chooser.get() == "C": mos.compute_partB() mos.update_src_images() mos.read_src_images() mos.create_mosaic()
def test_speed_mosaic(): m = Mosaic("dali") m.create_mosaic("karan.jpg", 10) m.save_as("karan_mosaic.jpg")
def test_speed_mosaic(): m = Mosaic('dali') m.create_mosaic('karan.jpg', 10) m.save_as('karan_mosaic.jpg')