Esempio n. 1
0
def write_visibility_files(set_loc, set_xx_key, data_loc, set_xx_idx):
    vis_list = get_fullpath_list(data_loc, "visibility")
    vis_dir = os.path.join(set_loc, 'visibility')
    if not os.path.exists(vis_dir):
        os.makedirs(vis_dir)

    # For each key in `set_xx`, load its visibility file and
    # feed the current visibility file with the order
    vis = load_vis(vis_list)
    for idx_key, name_key in zip(set_xx_idx, set_xx_key):
        vis_key = vis[idx_key]

        vis_file_name = 'vis_' + name_key + '.txt'

        # For each image, generate a visibility file
        # Store num matches from the information in pairs
        # If same image, keep -1
        # If no mathes, keep 0
        # First get the file name
        file_name = os.path.join(vis_dir, vis_file_name)

        # Open file and fill contents
        with open(file_name, 'w') as f:
            for key2 in set_xx_idx:
                f.write(str(vis_key[key2]) + '\n')
Esempio n. 2
0
def compute_image_pairs(vis_list, num_images, vis_th):
    vis = load_vis(vis_list)
    image_pairs = []
    for ii, jj in itertools.product(xrange(num_images), xrange(num_images)):
        if ii != jj:
            if vis[ii][jj] > vis_th:
                image_pairs.append((ii, jj))
    return image_pairs
Esempio n. 3
0
def compute_image_pairs(vis_list, num_images, vis_th):
    vis = load_vis(vis_list)