54 if (view ==
nullptr) {
55 LOG(WARNING) <<
"Cannot perform 2D<-->3D matching. View must not be null.";
60 std::vector<Descriptor> descriptors_2d;
61 std::vector<size_t> observation_indices;
62 std::vector<Observation::Ptr> observations = view->Observations();
63 for (
size_t ii = 0; ii < observations.size(); ++ii) {
64 CHECK_NOTNULL(observations[ii].
get());
65 if (!observations[ii]->IsIncorporated()) {
66 descriptors_2d.push_back(observations[ii]->
Descriptor());
67 observation_indices.push_back(ii);
72 std::vector<Descriptor> descriptors_3d;
73 descriptors_3d.reserve(landmark_indices.size());
74 for (
size_t ii = 0; ii < landmark_indices.size(); ii++) {
76 CHECK_NOTNULL(landmark.get());
77 descriptors_3d.push_back(landmark->Descriptor());
85 std::vector<LightFeatureMatch> forward_matches;
93 std::vector<LightFeatureMatch> reverse_matches;
103 size_t num_features_out = forward_matches.size();
109 std::partial_sort(forward_matches.begin(),
110 forward_matches.begin() + num_features_out,
111 forward_matches.end(),
117 for (
size_t ii = 0; ii < forward_matches.size(); ii++) {
118 const size_t observation_index =
119 observation_indices[forward_matches[ii].feature_index1_];
121 landmark_indices[forward_matches[ii].feature_index2_];
123 observations[observation_index]->SetMatchedLandmark(landmark_index);
static Landmark::Ptr GetLandmark(LandmarkIndex landmark_index)
unsigned int LandmarkIndex
static DistanceMetric & Instance()
static bool SortByDistance(const LightFeatureMatch &lhs, const LightFeatureMatch &rhs)
unsigned int num_best_matches
void ComputeSymmetricMatches(const std::vector< LightFeatureMatch > &feature_matches_lhs, std::vector< LightFeatureMatch > &feature_matches_rhs)
unsigned int min_num_feature_matches
static View::Ptr GetView(ViewIndex view_index)
std::shared_ptr< Landmark > Ptr
std::shared_ptr< View > Ptr
void ComputeOneWayMatches(const std::vector< Descriptor > &descriptors1, const std::vector< Descriptor > &descriptors2, std::vector< LightFeatureMatch > &matches)
bool MaybeNormalizeDescriptors(std::vector< Descriptor > &descriptors) const
::Eigen::Matrix< double, Eigen::Dynamic, 1 > Descriptor
bool only_keep_best_matches
FeatureMatcherOptions options_
bool require_symmetric_matches