Exemple #1
0
weak_dict = {}
for i, img in enumerate(proj.image_list):
    # print img.name, img.feature_count
    if img.feature_count > 0 and img.feature_count < 25:
        weak_dict[i] = True
print('weak images:', weak_dict)

# mark any features in the weak images list
for i, match in enumerate(matches_orig):
    #print 'before:', match
    for j, p in enumerate(match[1:]):
        if p[0] in weak_dict:
            match[j + 1] = [-1, -1]
            mark_sum += 1
    #print 'after:', match

if mark_sum > 0:
    print('Outliers removed from match lists:', mark_sum)
    result = input('Save these changes? (y/n):')
    if result == 'y' or result == 'Y':
        cull.delete_marked_features(matches_orig)
        cull.delete_marked_features(matches_opt)

        # write out the updated match dictionaries
        print("Writing original matches...")
        pickle.dump(matches_orig, open(os.path.join(args.project, source),
                                       "wb"))
        print("Writing optimized matches...")
        pickle.dump(matches_opt,
                    open(os.path.join(args.project, "matches_opt"), "wb"))
Exemple #2
0
                        if m[0] == i and m[1] == p0:
                            pos1 = pos
                        if m[0] == j and m[1] == p1:
                            pos2 = pos
                    if pos1 >= 0 and pos2 >= 0:
                        print("found in match: ", k)
                        mark_list.append([k, pos1])
                        mark_list.append([k, pos2])

if len(mark_list):
    print('Outliers marked:', len(mark_list))
    result = input('Save these changes? (y/n):')
    if result == 'y' or result == 'Y':
        # mark and delete the outliers
        cull.mark_using_list(mark_list, matches)
        cull.delete_marked_features(matches)

        # write out the updated match dictionaries
        print("Writing matches (direct) ...")
        pickle.dump(matches,
                    open(os.path.join(args.project, "matches_direct"), "wb"))

print('Number of features:', len(matches))

print('Hard coded exit in mid script...')
quit()

# run through the match list and compute the homography error (in image space)
error_list = []
for k, match in enumerate(matches):
    max_dist = 0.0