PICCANTE  0.4
The hottest HDR imaging library!
binary_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_BINARY_FEATURE_BRUTE_FORCE_MATCHER
19 #define PIC_FEATURES_MATCHING_BINARY_FEATURE_BRUTE_FORCE_MATCHER
20 
21 #include <vector>
22 
23 #include "../features_matching/feature_matcher.hpp"
24 
25 namespace pic{
26 
27 #ifndef PIC_DISABLE_EIGEN
28 
32 class BinaryFeatureBruteForceMatcher : public FeatureMatcher<unsigned int>
33 {
34 public:
35 
41  BinaryFeatureBruteForceMatcher(std::vector<unsigned int *> *descs, unsigned int desc_size) : FeatureMatcher<unsigned int>(descs, desc_size)
42  {
43  }
44 
52  bool getMatch(unsigned int *desc, int &matched_j, unsigned int &dist_1)
53  {
54  unsigned int dist_2 = 0;
55 
56  dist_1 = 0;
57 
58  matched_j = -1;
59 
60  for(unsigned int j = 0; j < descs->size(); j++) {
61  unsigned int dist = BRIEFDescriptor::match(desc, descs->at(j), desc_size);
62 
63  if(dist > dist_1) {
64  dist_2 = dist_1;
65  dist_1 = dist;
66  matched_j = j;
67  } else {
68  if(dist > dist_2) {
69  dist_2 = dist;
70  }
71  }
72  }
73 
74  return ((dist_1 * 100 > dist_2 * 105) && matched_j != -1);
75  }
76 };
77 
78 #endif
79 
80 }
81 
82 #endif // PIC_FEATURES_MATCHING_BINARY_FEATURE_BRUTE_FORCE_MATCHER
The FeatureMatcher class.
Definition: feature_matcher.hpp:39
BinaryFeatureBruteForceMatcher(std::vector< unsigned int *> *descs, unsigned int desc_size)
BinaryFeatureBruteForceMatcher.
Definition: binary_feature_brute_force_matcher.hpp:41
std::vector< unsigned int *> * descs
Definition: feature_matcher.hpp:42
static uint match(uint *fv0, uint *fv1, uint nfv)
match matches two descriptors. Note: Higher scores means better matching.
Definition: brief_descriptor.hpp:255
Definition: bilateral_separation.hpp:25
unsigned int desc_size
Definition: feature_matcher.hpp:43
bool getMatch(unsigned int *desc, int &matched_j, unsigned int &dist_1)
getMatch
Definition: binary_feature_brute_force_matcher.hpp:52
The BinaryFeatureBruteForceMatcher class.
Definition: binary_feature_brute_force_matcher.hpp:32