def heights_fusion(tile): """ Merge the height maps computed for each image pair and generate a ply cloud. Args: tile: a dictionary that provides all you need to process a tile """ tile_dir = tile['dir'] height_maps = [os.path.join(tile_dir, 'pair_%d' % (i + 1), 'height_map.tif') for i in range(len(cfg['images']) - 1)] # remove spurious matches if cfg['cargarse_basura']: for img in height_maps: common.cargarse_basura(img, img) # load global mean heights global_mean_heights = [] for i in range(len(cfg['images']) - 1): x = np.loadtxt(os.path.join(cfg['out_dir'], 'global_mean_height_pair_{}.txt'.format(i+1))) global_mean_heights.append(x) # merge the height maps (applying mean offset to register) fusion.merge_n(os.path.join(tile_dir, 'height_map.tif'), height_maps, global_mean_heights, averaging=cfg['fusion_operator'], threshold=cfg['fusion_thresh']) if cfg['clean_intermediate']: for f in height_maps: common.remove(f)
def heights_fusion(tile, mean_heights_global): """ Merge the height maps computed for each image pair and generate a ply cloud. Args: tile: a dictionary that provides all you need to process a tile mean_heights_global: list containing the means of all the global height maps """ tile_dir = tile['dir'] nb_pairs = len(mean_heights_global) height_maps = [ os.path.join(tile_dir, 'pair_%d' % (i + 1), 'height_map.tif') for i in range(nb_pairs) ] # remove spurious matches if cfg['cargarse_basura']: for img in height_maps: common.cargarse_basura(img, img) # merge the height maps (applying mean offset to register) fusion.merge_n(os.path.join(tile_dir, 'height_map.tif'), height_maps, mean_heights_global, averaging=cfg['fusion_operator'], threshold=cfg['fusion_thresh']) if cfg['clean_intermediate']: for f in height_maps: common.remove(f)