43 int image_index1,
int image_index2,
50 std::vector<Descriptor>& descriptors1 =
52 std::vector<Descriptor>& descriptors2 =
72 reverse_light_feature_matches);
74 light_feature_matches);
82 unsigned int num_features_out = light_feature_matches.size();
88 std::partial_sort(light_feature_matches.begin(),
89 light_feature_matches.begin() + num_features_out,
90 light_feature_matches.end(),
95 for (
int ii = 0; ii < num_features_out; ++ii) {
96 const auto& match = light_feature_matches[ii];
98 const Feature& matched_feature1 =
100 const Feature& matched_feature2 =
115 const std::vector<Descriptor>& descriptors1,
116 const std::vector<Descriptor>& descriptors2,
117 std::vector<LightFeatureMatch>& putative_matches) {
118 putative_matches.clear();
129 for (
size_t ii = 0; ii < descriptors1.size(); ++ii) {
131 for (
size_t jj = 0; jj < descriptors2.size(); ++jj) {
132 double dist = distance(descriptors1[ii], descriptors2[jj]);
136 if (dist < distance.
Max()) {
137 one_way_matches.emplace_back(ii, jj, dist);
145 std::partial_sort(one_way_matches.begin(),
146 one_way_matches.begin() + 1,
147 one_way_matches.end(),
151 double lowes_ratio_squared =
153 if (one_way_matches[0].distance_ <
154 lowes_ratio_squared * one_way_matches[1].distance_) {
155 putative_matches.emplace_back(one_way_matches[0]);
158 putative_matches.emplace_back(one_way_matches[0]);
virtual void SymmetricMatches(const std::vector< LightFeatureMatch > &feature_matches_lhs, std::vector< LightFeatureMatch > &feature_matches_rhs)
std::vector< std::vector< Feature > > image_features_
bool enforce_maximum_descriptor_distance
std::vector< LightFeatureMatch > LightFeatureMatchList
static DistanceMetric & Instance()
static bool SortByDistance(const LightFeatureMatch &lhs, const LightFeatureMatch &rhs)
void SetMaximumDistance(double maximum_distance)
void ComputePutativeMatches(const std::vector< Descriptor > &descriptors1, const std::vector< Descriptor > &descriptors2, std::vector< LightFeatureMatch > &putative_matches)
unsigned int num_best_matches
FeatureMatchList feature_matches_
unsigned int min_num_feature_matches
virtual bool MatchImagePair(int image_index1, int image_index2, PairwiseImageMatch &feature_matches)
double maximum_descriptor_distance
std::vector< std::vector< Descriptor > > image_descriptors_
bool MaybeNormalizeDescriptors(std::vector< Descriptor > &descriptors) const
std::vector< int > descriptor_indices1_
std::vector< int > descriptor_indices2_
bool only_keep_best_matches
FeatureMatcherOptions options_
bool require_symmetric_matches