Esempio n. 1
0
def match_by_max_pmcc(tiles_dir, working_dir, jar_file):
    # create a workspace directory if not found
    if not os.path.exists(working_dir):
        os.makedirs(working_dir)

    tile_files = glob.glob(os.path.join(tiles_dir, '*'))

    tiles = load_entire_data(tile_files)

    # TODO: add all tiles to a kd-tree so it will be faster to find overlap between tiles

    # iterate over the tiles, and for each tile, find intersecting tiles that overlap,
    # and match their features
    # Nested loop:
    #    for each tile_i in range[0..N):
    #        for each tile_j in range[tile_i..N)]
    for pair in itertools.combinations(tiles, 2):
        # if the two tiles intersect, match them
        bbox1 = BoundingBox(tiles[pair[0]]['boundingBox'])
        bbox2 = BoundingBox(tiles[pair[1]]['boundingBox'])
        if bbox1.overlap(bbox2):
            print "Matching by max pmcc tiles: {0} and {1}".format(
                pair[0], pair[1])
            match_two_tiles_by_max_pmcc_features(tiles[pair[0]],
                                                 tiles[pair[1]], jar_file,
                                                 working_dir)
Esempio n. 2
0
def match_sift_features(tiles_dir, features_dir, working_dir, jar_file):
    # create a workspace directory if not found
    if not os.path.exists(working_dir):
        os.makedirs(working_dir)


    tile_files = glob.glob(os.path.join(tiles_dir, '*'))
    features_files = glob.glob(os.path.join(features_dir, '*'))

    tiles = load_entire_data(tile_files, features_files)

    # TODO: add all tiles to a kd-tree so it will be faster to find overlap between tiles

    # iterate over the tiles, and for each tile, find intersecting tiles that overlap,
    # and match their features
    # Nested loop:
    #    for each tile_i in range[0..N):
    #        for each tile_j in range[tile_i..N)]
    for pair in itertools.combinations(tiles, 2):
        # if the two tiles intersect, match them
        bbox1 = BoundingBox(tiles[pair[0]]['boundingBox'])
        bbox2 = BoundingBox(tiles[pair[1]]['boundingBox'])
        if bbox1.overlap(bbox2):
            print "Matching sift of tiles: {0} and {1}".format(pair[0], pair[1])
            match_two_tiles_sift_features(tiles[pair[0]], tiles[pair[1]], jar_file, working_dir)