def __init__(self, tar_img, ref_img, src_pts, dst_pts, grid_size=100, scale_factor=15): ''' The image stitching engine usings APAP algorithm. tar_img : Target image that will be warped to be stitched to reference image. ref_img : Reference image that will not be warped. src_pts : Paired key points' coordinates in target image. dst_pts : Paired key points' coordinates in reference image. grid_size : The grid size is grid_size by grid_size. scale_factor : Scale factor used in matching pairs' weight adjustment. ''' self.src_pts = src_pts self.dst_pts = dst_pts self.scale_factor = scale_factor self.grids = Grids(grid_size, tar_img.shape[0], tar_img.shape[1]) self.mask = None self.homoMat = HomoMatrix()
def main(): grids = Grids() grid = grids.grid5 path = eval(grid, 15) print("---- Path is of length: {}".format(len(path))) astar_animation(path, grid)
def set_grid(self, h=0.2, cutoff=3.0): if self.calculation_required(self.el.atoms, ['energy']): raise AssertionError('Electronic structure is not solved yet!') if self.flags['grid'] == False: self.gd = Grids(self, h, cutoff) self.flags['grid'] = True