match3pcs.h
Go to the documentation of this file.
1 //
2 // Created by Sandra Alfaro on 30/05/18.
3 //
4 
5 #ifndef OPENGR_MATCH3PCSBASE_H
6 #define OPENGR_MATCH3PCSBASE_H
7 
8 #include <vector>
9 #include "gr/utils/shared.h"
10 #include "gr/utils/sampling.h"
11 #include "gr/algorithms/congruentSetExplorationBase.h"
12 #include "matchBase.h"
13 
14 #ifdef TEST_GLOBAL_TIMINGS
15 # include "gr/utils/timer.h"
16 #endif
17 
18 namespace gr {
19  template <typename PointType>
20  struct Traits3pcs {
21  static constexpr int size() { return 3; }
22  using Base = std::array<int,3>;
23  using Set = std::vector<Base>;
24  using Coordinates = std::array<const PointType*, 3>;
25  };
26 
27  /// Class for the computation of the 3PCS algorithm.
28  template <typename _PointType,
29  typename _TransformVisitor,
30  typename _PairFilteringFunctor, /// <\brief Must implements PairFilterConcept
31  template < class, class > class PairFilteringOptions >
33  public:
36  using PairFilteringFunctor = _PairFilteringFunctor;
37  using TransformVisitor = _TransformVisitor;
38 
39  using CongruentBaseType = typename Traits::Base;
40  using Set = typename Traits::Set;
41  using Coordinates = typename Traits::Coordinates;
42 
44 
46  using Scalar = typename MatchBaseType::Scalar;
47 
48  Match3pcs (const OptionsType& options
49  , const Utils::Logger& logger);
50 
51  virtual ~Match3pcs();
52 
53  /// Find all the congruent set similar to the base in the second 3D model (Q).
54  /// It could be with a 3 point base or a 4 point base.
55  /// \param base use to find the similar points congruent in Q.
56  /// \param congruent_set a set of all point congruent found in Q.
57  bool generateCongruents (CongruentBaseType& base, Set& congruent_quads) override;
58 
59  /// Tries to compute an inital base from P
60  /// @param [out] base The base, if found. Initial value is not used. Modified as
61  /// the computed base if the return value is true.
62  /// @return true if a base is found an initialized, false otherwise
63  bool initBase(CongruentBaseType &base) override;
64  };
65 }
66 
67 #include "match3pcs.hpp"
68 #endif //OPENGR_MATCH3PCSBASE_H
virtual ~Match3pcs()
Definition: match3pcs.hpp:30
static constexpr int size()
Definition: match3pcs.h:21
bool generateCongruents(CongruentBaseType &base, Set &congruent_quads) override
Find all the congruent set similar to the base in the second 3D model (Q). It could be with a 3 point...
Definition: match3pcs.hpp:36
Class for the computation of the 3PCS algorithm.
Definition: match3pcs.h:32
CongruentSetExplorationBase< Traits, PointType, TransformVisitor, PairFilteringFunctor, OptExts... >::Scalar ComputeTransformation(const InputRange1 &P, const InputRange2 &Q, Eigen::Ref< typename CongruentSetExplorationBase< Traits, PointType, TransformVisitor, PairFilteringFunctor, OptExts... >::MatrixType > transformation, const Sampler< PointType > &sampler, TransformVisitor &v)
Definition: congruentSetExplorationBase.hpp:61
void get(int queryId, int nElPerDim, int, typename NeighborhoodType< 3 >::ptr first, typename NeighborhoodType< 3 >::ptr)
Definition: utils.h:279
bool initBase(CongruentBaseType &base) override
Tries to compute an inital base from P.
Definition: match3pcs.hpp:95
Definition: logger.h:62
Match3pcs(const OptionsType &options, const Utils::Logger &logger)
Definition: match3pcs.hpp:20