| 420 | } |
| 421 | |
| 422 | SequentialPairGenerator::SequentialPairGenerator( |
| 423 | const SequentialPairingOptions& options, |
| 424 | const std::shared_ptr<FeatureMatcherCache>& cache) |
| 425 | : options_(options), cache_(THROW_CHECK_NOTNULL(cache)) { |
| 426 | THROW_CHECK(options.Check()); |
| 427 | LOG(INFO) << "Generating sequential image pairs..."; |
| 428 | image_ids_ = GetOrderedImageIds(); |
| 429 | image_pairs_.reserve(options_.overlap); |
| 430 | |
| 431 | if (options_.loop_detection) { |
| 432 | std::vector<image_t> query_image_ids; |
| 433 | for (size_t i = 0; i < image_ids_.size(); |
| 434 | i += options_.loop_detection_period) { |
| 435 | query_image_ids.push_back(image_ids_[i]); |
| 436 | } |
| 437 | vocab_tree_pair_generator_ = std::make_unique<VocabTreePairGenerator>( |
| 438 | options_.VocabTreeOptions(), cache_, query_image_ids); |
| 439 | } |
| 440 | |
| 441 | if (options_.expand_rig_images) { |
| 442 | const std::vector<frame_t> frame_ids = cache_->GetFrameIds(); |
| 443 | frame_to_image_ids_.reserve(frame_ids.size()); |
| 444 | image_to_frame_ids_.reserve(image_ids_.size()); |
| 445 | for (const frame_t frame_id : frame_ids) { |
| 446 | const Frame& frame = cache_->GetFrame(frame_id); |
| 447 | auto& frame_image_ids = frame_to_image_ids_[frame_id]; |
| 448 | for (const data_t& data_id : frame.ImageIds()) { |
| 449 | frame_image_ids.push_back(data_id.id); |
| 450 | image_to_frame_ids_[data_id.id] = frame_id; |
| 451 | } |
| 452 | } |
| 453 | } |
| 454 | } |
| 455 | |
| 456 | SequentialPairGenerator::SequentialPairGenerator( |
| 457 | const SequentialPairingOptions& options, |
nothing calls this directly
no test coverage detected