Created
March 11, 2019 17:09
-
-
Save etrulls/0a59b908b7d63097c6124f8b3afd0a2b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/compute_inliers_opt.py b/src/compute_inliers_opt.py | |
index 062c248..aca21e8 100644 | |
--- a/src/compute_inliers_opt.py | |
+++ b/src/compute_inliers_opt.py | |
@@ -8,6 +8,7 @@ from utils import loadh5 | |
import cv2 | |
import glob | |
from IPython import embed | |
+import os | |
# Colmap | |
import sys | |
@@ -156,7 +157,18 @@ def save_match_scores_colmap(image_pair, save_dir, data_dir, threshold, refine_i | |
# First read images.bin | |
err_q, err_t = np.inf, np.inf | |
if os.path.exists(save_dir + '{}/0/'.format(colmap_savename)): | |
- images_bin = read_images_binary(save_dir + '{}/0/images.bin'.format(colmap_savename)) | |
+ # Find the best reconstruction if there are several | |
+ best_index, best_num_images = 0, 0 | |
+ for cur_index in range(10): | |
+ if os.path.isdir(save_dir + '{}/{}/'.format(colmap_savename, cur_index)): | |
+ images_bin = read_images_binary(save_dir + '{}/{}/images.bin'.format(colmap_savename, cur_index)) | |
+ | |
+ # Sort by number of reconstructed images | |
+ if len(images_bin) > best_num_images: | |
+ best_index = cur_index | |
+ best_num_images = len(images_bin) | |
+ | |
+ images_bin = read_images_binary(save_dir + '{}/{}/images.bin'.format(colmap_savename, best_index)) | |
# For each key check if images_bin[key].name = image_name | |
R_1_actual, t_1_actual = None, None | |
R_2_actual, t_2_actual = None, None |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment