PICCANTE  0.4
The hottest HDR imaging library!
float_feature_brute_force_matcher.hpp
Go to the documentation of this file.
1 /*
2 
3 PICCANTE
4 The hottest HDR imaging library!
5 http://vcg.isti.cnr.it/piccante
6 
7 Copyright (C) 2014
8 Visual Computing Laboratory - ISTI CNR
9 http://vcg.isti.cnr.it
10 First author: Francesco Banterle
11 
12 This Source Code Form is subject to the terms of the Mozilla Public
13 License, v. 2.0. If a copy of the MPL was not distributed with this
14 file, You can obtain one at http://mozilla.org/MPL/2.0/.
15 
16 */
17 
18 #ifndef PIC_FEATURES_MATCHING_FLOAT_FEATURE_BRUTE_FORCE_MATCHER
19 #define PIC_FEATURES_MATCHING_FLOAT_FEATURE_BRUTE_FORCE_MATCHER
20 
21 #include <vector>
22 
23 #include "../features_matching/feature_matcher.hpp"
24 #include "../features_matching/sift_descriptor.hpp"
25 
26 namespace pic{
27 
28 #ifndef PIC_DISABLE_EIGEN
29 
34 {
35 public:
36 
42  FloatFeatureBruteForceMatcher(std::vector<unsigned int *> *descs, unsigned int desc_size) : FeatureMatcher<float>(descs, desc_size)
43  {
44  }
45 
53  bool getMatch(float *desc, int &matched_j, float &dist_1)
54  {
55  float dist_2 = 1e32f;
56 
57  dist_1 = 1e32f;
58 
59  matched_j = -1;
60 
61  for(unsigned int j = 0; j < descs->size(); j++) {
62  float dist = SIFTDescriptor::match(desc, descs->at(j), desc_size);
63 
64  if(dist < dist_1) {
65  dist_2 = dist_1;
66  dist_1 = dist;
67  matched_j = j;
68  } else {
69  if(dist < dist_2) {
70  dist_2 = dist;
71  }
72  }
73  }
74 
75  return ((dist_1 > dist_2 * 1.2f) && matched_j != -1);
76  }
77 };
78 
79 #endif
80 
81 }
82 
83 #endif // PIC_FEATURES_MATCHING_FLOAT_FEATURE_BRUTE_FORCE_MATCHER
static float match(float *fv0, float *fv1, int nfv)
Definition: sift_descriptor.hpp:243
FloatFeatureBruteForceMatcher(std::vector< unsigned int *> *descs, unsigned int desc_size)
FloatFeatureBruteForceMatcher.
Definition: float_feature_brute_force_matcher.hpp:42
The FeatureMatcher class.
Definition: feature_matcher.hpp:39
std::vector< float *> * descs
Definition: feature_matcher.hpp:42
The FloatFeatureBruteForceMatcher class.
Definition: float_feature_brute_force_matcher.hpp:33
Definition: bilateral_separation.hpp:25
bool getMatch(float *desc, int &matched_j, float &dist_1)
getMatch
Definition: float_feature_brute_force_matcher.hpp:53
float desc_size
Definition: feature_matcher.hpp:43