MCPcopy Create free account
hub / github.com/colmap/colmap / Reconstruct

Method Reconstruct

src/colmap/controllers/incremental_pipeline.cc:643–750  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

641}
642
643IncrementalPipeline::Status IncrementalPipeline::Reconstruct(
644 IncrementalMapper& mapper,
645 const IncrementalMapper::Options& mapper_options,
646 bool continue_reconstruction) {
647 for (int num_trials = 0; num_trials < options_->init_num_trials;
648 ++num_trials) {
649 if (CheckIfStopped() || CheckReachedMaxRuntime()) {
650 return Status::STOP;
651 }
652
653 const size_t reconstruction_idx =
654 (!continue_reconstruction || num_trials > 0)
655 ? reconstruction_manager_->Add()
656 : 0;
657 std::shared_ptr<Reconstruction> reconstruction =
658 reconstruction_manager_->Get(reconstruction_idx);
659
660 const Status status =
661 ReconstructSubModel(mapper, mapper_options, reconstruction);
662 switch (status) {
663 case Status::INTERRUPTED: {
664 reconstruction->UpdatePoint3DErrors();
665 LOG(INFO) << "Keeping reconstruction due to interrupt";
666 mapper.EndReconstruction(/*discard=*/false);
667 AlignReconstructionToOrigRigScales(database_cache_->Rigs(),
668 reconstruction.get());
669 return Status::STOP;
670 }
671
672 case Status::UNKNOWN_SENSOR_FROM_RIG: {
673 LOG(ERROR)
674 << "Discarding reconstruction due to unknown sensor_from_rig "
675 "poses. Either explicitly define the poses by configuring the "
676 "rigs or first run reconstruction without configured rigs and "
677 "then derive the poses from the initial reconstruction for a "
678 "subsequent reconstruction with rig constraints. See "
679 "documentation for detailed instructions.";
680 mapper.EndReconstruction(/*discard=*/true);
681 reconstruction_manager_->Delete(reconstruction_idx);
682 // If the reconstruction was discarded due to an unknown sensor from
683 // rig, we can stop the outer trial loop, because all trials will fail.
684 return Status::STOP;
685 }
686
687 case Status::BAD_INITIAL_PAIR: {
688 LOG(INFO) << "Discarding reconstruction due to bad initial pair";
689 mapper.EndReconstruction(/*discard=*/true);
690 reconstruction_manager_->Delete(reconstruction_idx);
691 // If an initial pair was found but it was bad, we discard and attempt
692 // to initialize from any of the remaining pairs in the next trials.
693 break;
694 }
695
696 case Status::NO_INITIAL_PAIR: {
697 LOG(INFO) << "Discarding reconstruction due to no initial pair";
698 mapper.EndReconstruction(/*discard=*/true);
699 reconstruction_manager_->Delete(reconstruction_idx);
700 // If no pair could be found, we can exit the trial loop, because

Callers

nothing calls this directly

Calls 10

UpdatePoint3DErrorsMethod · 0.80
EndReconstructionMethod · 0.80
NumRegImagesMethod · 0.80
NumTotalRegImagesMethod · 0.80
AddMethod · 0.45
GetMethod · 0.45
DeleteMethod · 0.45
SizeMethod · 0.45
NumImagesMethod · 0.45

Tested by

no test coverage detected