Пример #1
0
def sift_matrix():
    featurelist = sift_feature_listnames_generator()
    imlist = getFiles(
        '/home/aurora/hdd/workspace/PycharmProjects/data/N20040103G/')
    nbr_images = len(imlist)
    matchscores = np.zeros((nbr_images, nbr_images))
    for i in range(nbr_images):
        for j in range(i, nbr_images):
            # print 'comparing ', imlist[i], imlist[j]
            l1, d1 = sift.read_feature_from_file(featurelist[i])
            l2, d2 = sift.read_feature_from_file(featurelist[j])

            if d1.shape[0] == 0 or d2.shape[0] == 0:
                matchscores[i, j] = 0
            else:
                matches = sift.match_twosided(d1, d2)
                nbr_matches = sum(matches > 0)
                print 'number of matches = ', nbr_matches
                matchscores[i, j] = nbr_matches
    for i in range(nbr_images):
        for j in range(i + 1, nbr_images):
            matchscores[j, i] = matchscores[i, j]
    np.save(
        '/home/aurora/hdd/workspace/PycharmProjects/data/aurora_img_matches_matrix_20151212',
        matchscores)
    print matchscores
Пример #2
0
def get_sift_distance_matrix_without_constraint(img_vectors):
    img_vector = img_vectors.astype(dtype=np.int32)
    img_matrix = np.zeros((img_vector.shape[0], img_vector.shape[0]))
    for i in range(0, img_vector.shape[0]):
        for j in range(0, img_vector.shape[0]):
            l1, d1 = sift.read_feature_from_file('aurora'+str(i)+'.sift')
            l2, d2 = sift.read_feature_from_file('aurora'+str(j)+'.sift')
            img_matrix[i, j] = sift_distance(d1, d2)
    np.save('/home/aurora/hdd/workspace/PycharmProjects/data/sift_distance_2015_1211_without_constraint',img_matrix)
    return img_matrix
Пример #3
0
def get_sift_distance_matrix_without_constraint(img_vectors):
    img_vector = img_vectors.astype(dtype=np.int32)
    img_matrix = np.zeros((img_vector.shape[0], img_vector.shape[0]))
    for i in range(0, img_vector.shape[0]):
        for j in range(0, img_vector.shape[0]):
            l1, d1 = sift.read_feature_from_file('aurora' + str(i) + '.sift')
            l2, d2 = sift.read_feature_from_file('aurora' + str(j) + '.sift')
            img_matrix[i, j] = sift_distance(d1, d2)
    np.save(
        '/home/aurora/hdd/workspace/PycharmProjects/data/sift_distance_2015_1211_without_constraint',
        img_matrix)
    return img_matrix
Пример #4
0
def get_all_dsift_features(filepath):
    features_files = [os.path.join(filepath, filename) for index, filename in enumerate(os.listdir(filepath)) if filename.endswith('.dsift')]
    prefix = '/home/aurora/workspace/PycharmProjects/aurora_detection/dsift_features/dsiftaurora'
    suffix = '.dsift'
    feature = []
    for i in range(len(features_files)):
        file = prefix + str(i) + suffix
        l1, d1 = sift.read_feature_from_file(file)
        feature.append(d1.flatten())
    feature = np.array(feature)
    np.save('/home/aurora/hdd/workspace/PycharmProjects/data/dsift_features_2015_1214', feature)
    return feature
Пример #5
0
def sift_matrix():
    featurelist = sift_feature_listnames_generator()
    imlist = getFiles('/home/aurora/hdd/workspace/PycharmProjects/data/N20040103G/')
    nbr_images = len(imlist)
    matchscores = np.zeros((nbr_images, nbr_images))
    for i in range(nbr_images):
        for j in range(i, nbr_images):
            # print 'comparing ', imlist[i], imlist[j]
            l1, d1 = sift.read_feature_from_file(featurelist[i])
            l2, d2 = sift.read_feature_from_file(featurelist[j])

            if d1.shape[0] == 0 or d2.shape[0] == 0:
                matchscores[i, j] = 0
            else:
                matches = sift.match_twosided(d1, d2)
                nbr_matches = sum(matches > 0)
                print 'number of matches = ', nbr_matches
                matchscores[i, j] = nbr_matches
    for i in range(nbr_images):
        for j in range(i + 1, nbr_images):
            matchscores[j, i] = matchscores[i, j]
    np.save('/home/aurora/hdd/workspace/PycharmProjects/data/aurora_img_matches_matrix_20151212', matchscores)
    print matchscores
Пример #6
0
def get_all_dsift_features(filepath):
    features_files = [
        os.path.join(filepath, filename)
        for index, filename in enumerate(os.listdir(filepath))
        if filename.endswith('.dsift')
    ]
    prefix = '/home/aurora/workspace/PycharmProjects/aurora_detection/dsift_features/dsiftaurora'
    suffix = '.dsift'
    feature = []
    for i in range(len(features_files)):
        file = prefix + str(i) + suffix
        l1, d1 = sift.read_feature_from_file(file)
        feature.append(d1.flatten())
    feature = np.array(feature)
    np.save(
        '/home/aurora/hdd/workspace/PycharmProjects/data/dsift_features_2015_1214',
        feature)
    return feature