Berkeley SfM
naive_matcher_2d2d.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015, The Regents of the University of California (Regents).
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met:
8  *
9  * 1. Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * 2. Redistributions in binary form must reproduce the above
13  * copyright notice, this list of conditions and the following
14  * disclaimer in the documentation and/or other materials provided
15  * with the distribution.
16  *
17  * 3. Neither the name of the copyright holder nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
25  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  *
33  * Please contact the author(s) of this library if you have any questions.
34  * Authors: Erik Nelson ( eanelson@eecs.berkeley.edu )
35  * David Fridovich-Keil ( dfk@eecs.berkeley.edu )
36  */
37 
38 ///////////////////////////////////////////////////////////////////////////////
39 //
40 // This class defines a naive feature matcher. The matcher takes keypoints and
41 // descriptors from two images and searches for the best pairwise matches,
42 // a naive strategy that results in O(n^2) in the number of features.
43 //
44 ///////////////////////////////////////////////////////////////////////////////
45 
46 #ifndef BSFM_MATCHING_NAIVE_MATCHER_2D2D_H
47 #define BSFM_MATCHING_NAIVE_MATCHER_2D2D_H
48 
49 #include <algorithm>
50 #include <memory>
51 #include <vector>
52 
53 #include "distance_metric.h"
54 #include "feature.h"
55 #include "feature_match.h"
56 #include "feature_matcher.h"
57 #include "pairwise_image_match.h"
58 
59 #include "../image/image.h"
60 #include "../util/disallow_copy_and_assign.h"
61 #include "../util/types.h"
62 
63 namespace bsfm {
64 
66  public:
68  virtual ~NaiveMatcher2D2D() { }
69 
70  private:
72 
73  // Match two images together by doing a pairwise comparison of all of their
74  // individual feature descriptors.
75  virtual bool MatchImagePair(int image_index1, int image_index2,
76  PairwiseImageMatch& feature_matches);
77 
78  // Compute putative matches between feature descriptors for an image pair.
79  // These might be removed later on due to e.g. not being symmetric, etc.
80  void ComputePutativeMatches(const std::vector<Descriptor>& descriptors1,
81  const std::vector<Descriptor>& descriptors2,
82  std::vector<LightFeatureMatch>& putative_matches);
83 }; //\class NaiveMatcher2D2D
84 
85 } //\namespace bsfm
86 
87 #endif
STL namespace.
void ComputePutativeMatches(const std::vector< Descriptor > &descriptors1, const std::vector< Descriptor > &descriptors2, std::vector< LightFeatureMatch > &putative_matches)
Definition: camera.cpp:50
virtual bool MatchImagePair(int image_index1, int image_index2, PairwiseImageMatch &feature_matches)
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
::Eigen::Matrix< double, Eigen::Dynamic, 1 > Descriptor
Definition: types.h:83