@@ -176,10 +176,12 @@ void ConvertColmapPoints3DToGlomapTracks(
176176
177177// For ease of debug, go through the database twice: first extract the available
178178// pairs, then read matches from pairs.
179- void ConvertDatabaseToGlomap (const colmap::Database& database,
180- ViewGraph& view_graph,
181- std::unordered_map<camera_t , Camera>& cameras,
182- std::unordered_map<image_t , Image>& images) {
179+ void ConvertDatabaseToGlomap (
180+ const colmap::Database& database,
181+ ViewGraph& view_graph,
182+ std::unordered_map<camera_t , Camera>& cameras,
183+ std::unordered_map<image_t , Image>& images,
184+ const std::unordered_set<std::string>* image_filenames) {
183185 // Add the images
184186 std::vector<colmap::Image> images_colmap = database.ReadAllImages ();
185187 image_t counter = 0 ;
@@ -188,6 +190,11 @@ void ConvertDatabaseToGlomap(const colmap::Database& database,
188190 << images_colmap.size () << std::flush;
189191 counter++;
190192
193+ if (image_filenames &&
194+ image_filenames->find (image.Name ()) == image_filenames->end ()) {
195+ continue ; // Skip images not in the specified set
196+ }
197+
191198 const image_t image_id = image.ImageId ();
192199 if (image_id == colmap::kInvalidImageId ) continue ;
193200 auto ite = images.insert (std::make_pair (
@@ -239,6 +246,12 @@ void ConvertDatabaseToGlomap(const colmap::Database& database,
239246 colmap::image_t image_id1 = image_pair_colmap.first ;
240247 colmap::image_t image_id2 = image_pair_colmap.second ;
241248
249+ if (images.find (image_id1) == images.end () ||
250+ images.find (image_id2) == images.end ()) {
251+ // If the image is not added to the images map, then skip
252+ continue ;
253+ }
254+
242255 colmap::FeatureMatches& feature_matches = all_matches[match_idx].second ;
243256
244257 // Initialize the image pair
0 commit comments