@@ -220,27 +220,31 @@ void ConvertDatabaseToGlomap(const colmap::Database& database,
220220 cameras[camera_id] = camera;
221221 }
222222
223- // Add the matches
224- std::vector<std::pair<colmap:: image_pair_t , colmap::FeatureMatches>>
225- all_matches = database.ReadAllMatches ();
223+ // Add the valid matches
224+ std::vector<std::pair<image_pair_t , int >> two_view_geometries_inliers =
225+ database.ReadTwoViewGeometryNumInliers ();
226226
227227 // Go through all matches and store the matche with enough observations in the
228228 // view_graph
229229 size_t invalid_count = 0 ;
230230 std::unordered_map<image_pair_t , ImagePair>& image_pairs =
231231 view_graph.image_pairs ;
232- for (size_t match_idx = 0 ; match_idx < all_matches.size (); match_idx++) {
233- if ((match_idx + 1 ) % 1000 == 0 || match_idx == all_matches.size () - 1 )
232+ for (size_t match_idx = 0 ; match_idx < two_view_geometries_inliers.size ();
233+ match_idx++) {
234+ if ((match_idx + 1 ) % 1000 == 0 ||
235+ match_idx == two_view_geometries_inliers.size () - 1 )
234236 std::cout << " \r Loading Image Pair " << match_idx + 1 << " / "
235- << all_matches .size () << std::flush;
237+ << two_view_geometries_inliers .size () << std::flush;
236238 // Read the image pair from COLMAP database
237- colmap::image_pair_t pair_id = all_matches [match_idx].first ;
239+ colmap::image_pair_t pair_id = two_view_geometries_inliers [match_idx].first ;
238240 std::pair<colmap::image_t , colmap::image_t > image_pair_colmap =
239241 database.PairIdToImagePair (pair_id);
240242 colmap::image_t image_id1 = image_pair_colmap.first ;
241243 colmap::image_t image_id2 = image_pair_colmap.second ;
242244
243- colmap::FeatureMatches& feature_matches = all_matches[match_idx].second ;
245+ // colmap::FeatureMatches& feature_matches = all_matches[match_idx].second;
246+ colmap::FeatureMatches feature_matches =
247+ database.ReadMatches (image_id1, image_id2);
244248
245249 // Initialize the image pair
246250 auto ite = image_pairs.insert (
0 commit comments