Super4PCS Library  V1.1.2(719f5c0)
4pcs.h
1 // Copyright 2012 Dror Aiger
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 //
15 // -------------------------------------------------------------------------- //
16 //
17 // Authors: Dror Aiger, Yoni Weill
18 //
19 // An implementation of the 4-points Congruent Sets (4PCS) algorithm presented
20 // in:
21 //
22 // 4-points Congruent Sets for Robust Surface Registration
23 // Dror Aiger, Niloy J. Mitra, Daniel Cohen-Or
24 // ACM SIGGRAPH 2008 and ACM Transaction of Graphics.
25 //
26 // Given two sets of points in 3-space, P and Q, the algorithm applies RANSAC
27 // in roughly O(n^2) time instead of O(n^3) for standard RANSAC, using an
28 // efficient method based on invariants, to find the set of all 4-points in Q
29 // that can be matched by rigid transformation to a given set of 4-points in P
30 // called a base. This avoids the need to examine all sets of 3-points in Q
31 // against any base of 3-points in P as in standard RANSAC.
32 // The algorithm can use colors and normals to speed-up the matching
33 // and to improve the quality. It can be easily extended to affine/similarity
34 // transformation but then the speed-up is smaller because of the large number
35 // of congruent sets. The algorithm can also limit the range of transformations
36 // when the application knows something on the initial pose but this is not
37 // necessary in general (though can speed the runtime significantly).
38 
39 // Home page of the 4PCS project (containing the paper, presentations and a
40 // demo): http://graphics.stanford.edu/~niloy/research/fpcs/fpcs_sig_08.html
41 // Use google search on "4-points congruent sets" to see many related papers
42 // and applications.
43 
44 #ifndef _SUPER4PCS_ALGO_4PCS_H_
45 #define _SUPER4PCS_ALGO_4PCS_H_
46 
47 #include "super4pcs/algorithms/match4pcsBase.h"
48 
49 namespace GlobalRegistration {
50 
52 class Match4PCS : public Match4PCSBase {
53 public:
55  using Scalar = typename Base::Scalar;
56  using PairsVector = typename Base::PairsVector;
57  using VectorType = typename Base::VectorType;
58 
59  explicit Match4PCS(const Match4PCSOptions& options,
60  const Utils::Logger logger);
61 
62  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
63 
64  ~Match4PCS();
65 
66 protected:
80  void
81  ExtractPairs(
82  Scalar pair_distance,
83  Scalar pair_normals_angle,
84  Scalar pair_distance_epsilon, int base_point1,
85  int base_point2,
86  PairsVector* pairs) const override;
87 
101  bool FindCongruentQuadrilaterals(
102  Scalar invariant1,
103  Scalar invariant2,
104  Scalar distance_threshold1,
105  Scalar distance_threshold2,
106  const PairsVector& P_pairs,
107  const PairsVector& Q_pairs,
108  std::vector<Quadrilateral>* quadrilaterals) const override;
109 
115  void Initialize(const std::vector<Point3D>& P,
116  const std::vector<Point3D>& Q) override;
117 };
118 }
119 
120 #endif
std::vector< std::pair< int, int > > PairsVector
Definition: match4pcsBase.h:68
typename Base::Scalar Scalar
Definition: 4pcs.h:55
typename Base::VectorType VectorType
Definition: 4pcs.h:57
Match4PCS(const Match4PCSOptions &options, const Utils::Logger logger)
Definition: 4pcs.cc:54
EIGEN_MAKE_ALIGNED_OPERATOR_NEW ~Match4PCS()
Definition: 4pcs.cc:58
Definition: bbox.h:54
typename Point3D::VectorType VectorType
Definition: match4pcsBase.h:70
Definition: match4pcsBase.h:65
Class for the computation of the 4PCS algorithm.
Definition: 4pcs.h:52
delta and overlap_estimation are the application parameters. All other parameters are more likely to ...
Definition: shared4pcs.h:148
typename Base::PairsVector PairsVector
Definition: 4pcs.h:56
typename Point3D::Scalar Scalar
Definition: match4pcsBase.h:69
Definition: logger.h:62