Exemple #1
0
def truth_neogeo(tiles, tid, post, xb, yb):
    tidindb = np.array([np.intersect1d(tt, tid).shape[0] for tt in tiles])
    gidx = np.where(tidindb > 0)[0]
    img_in_db = gidx.shape[0]
    gcnt = 0
    gmatch = 0
    matched_idx = False
    for ii in gidx:
        amax = np.unravel_index(np.argmax(post[ii]), post[ii].shape)
        amax = np.array(amax)
        amax = amax + np.array([yb[0], xb[0]])
        tile_id = pdb.elegant_pair_xy(amax[1], amax[0])
        if tile_id in tiles[ii]:
            gcnt += 1
            if not matched_idx:
                gmatch = ii
                matched_idx = True
    return gcnt, gmatch
Exemple #2
0
    kidx1 = np.argsort(r1)[-num_feat:]
    kpts1 = f2d.keypoint_pixels(kp1)[kidx1]
    ddesc1 = desc1[kidx1]

    # Load Database Info
    tbdb = tb.open_file('/media/sean/D2F2E7B2F2E798CD/Users/student/neo_data/pytables_db.hdf', 'r')
    db = tbdb.root.sift_db.sift_features_sorted
    bbox = mercantile.LngLatBbox(corners_wgs[:, 0].min(),
                                 corners_wgs[:, 1].min(),
                                 corners_wgs[:, 0].max(),
                                 corners_wgs[:, 1].max())
    tiles = [t for t in mercantile.tiles(*bbox, zooms=[15])]
    print(tiles)

    tuids = [pdb.elegant_pair_xy(t.x, t.y) for t in tiles]
    rows = [db.read_where('pair_id == uid') for uid in tuids]

    # Downsample by response
    rows_per_tile = 10000
    rows = [np.sort(f, order='response')[-rows_per_tile:] for f in rows]

    tile1_desc = rows[0]['descriptor']
    tile2_desc = rows[1]['descriptor']

    ophoto = hdo.HDFOrthophoto('/media/sean/D2F2E7B2F2E798CD/Users/student/neo_data/dugway_ciortho.hdf')#, '/ophoto/gray')
    t_photo = ophoto.get_img_from_bounds(bbox)
    ddesc1 = ddesc1.astype(np.float32)
    tile1_desc = tile1_desc.astype(np.float32)
    mmask, mimg = air_2_db(tile1_desc, ddesc1, kpts1, rows[0], img1, t_photo, cv2.NORM_L2, thresh=0.7)
Exemple #3
0
def get_tiles_in_extent(extent):
    for xid in np.arange(extent.xb[0], extent.xb[1] + 1):
        for yid in np.arange(extent.yb[0], extent.yb[1] + 1):
            yield pdb.elegant_pair_xy(xid, yid)