Point Cloud Library (PCL)  1.11.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
coherence.h
1 #pragma once
2 
3 #include <pcl/pcl_base.h>
4 
5 namespace pcl
6 {
7 
8  namespace tracking
9  {
10 
11  /** \brief @b PointCoherence is a base class to compute coherence between the two points.
12  * \author Ryohei Ueda
13  * \ingroup tracking
14  */
15  template <typename PointInT>
17  {
18  public:
19  using Ptr = shared_ptr<PointCoherence<PointInT> >;
20  using ConstPtr = shared_ptr<const PointCoherence<PointInT> >;
21 
22  public:
23  /** \brief empty constructor */
25 
26  /** \brief empty distructor */
27  virtual ~PointCoherence () {}
28 
29  /** \brief compute coherence from the source point to the target point.
30  * \param source instance of source point.
31  * \param target instance of target point.
32  */
33  inline double
34  compute (PointInT &source, PointInT &target);
35 
36  protected:
37 
38  /** \brief The coherence name. */
39  std::string coherence_name_;
40 
41  /** \brief abstract method to calculate coherence.
42  * \param[in] source instance of source point.
43  * \param[in] target instance of target point.
44  */
45  virtual double
46  computeCoherence (PointInT &source, PointInT &target) = 0;
47 
48  /** \brief Get a string representation of the name of this class. */
49  inline const std::string&
50  getClassName () const { return (coherence_name_); }
51 
52  };
53 
54  /** \brief @b PointCloudCoherence is a base class to compute coherence between the two PointClouds.
55  * \author Ryohei Ueda
56  * \ingroup tracking
57  */
58  template <typename PointInT>
60  {
61  public:
62  using Ptr = shared_ptr<PointCloudCoherence<PointInT> >;
63  using ConstPtr = shared_ptr<const PointCloudCoherence<PointInT> >;
64 
68 
70  /** \brief Constructor. */
72 
73  /** \brief Destructor. */
74  virtual ~PointCloudCoherence () {}
75 
76  /** \brief compute coherence between two pointclouds. */
77  inline void
78  compute (const PointCloudInConstPtr &cloud, const IndicesConstPtr &indices,
79  float &w_i);
80 
81  /** \brief get a list of pcl::tracking::PointCoherence.*/
82  inline std::vector<PointCoherencePtr>
84 
85  /** \brief set a list of pcl::tracking::PointCoherence.
86  * \param coherences a list of pcl::tracking::PointCoherence.
87  */
88  inline void
89  setPointCoherences (std::vector<PointCoherencePtr> coherences) { point_coherences_ = coherences; }
90 
91  /** \brief This method should get called before starting the actual computation. */
92  virtual bool initCompute ();
93 
94  /** \brief add a PointCoherence to the PointCloudCoherence.
95  * \param coherence a pointer to PointCoherence.
96  */
97  inline void
98  addPointCoherence (PointCoherencePtr coherence) { point_coherences_.push_back (coherence); }
99 
100  /** \brief add a PointCoherence to the PointCloudCoherence.
101  * \param cloud a pointer to PointCoherence.
102  */
103  virtual inline void
105 
106  protected:
107  /** \brief Abstract method to compute coherence. */
108  virtual void
109  computeCoherence (const PointCloudInConstPtr &cloud, const IndicesConstPtr &indices, float &w_j) = 0;
110 
111  inline double calcPointCoherence (PointInT &source, PointInT &target);
112 
113  /** \brief Get a string representation of the name of this class. */
114  inline const std::string&
115  getClassName () const { return (coherence_name_); }
116 
117 
118  /** \brief The coherence name. */
119  std::string coherence_name_;
120 
121  /** \brief a pointer to target point cloud*/
123 
124  /** \brief a list of pointers to PointCoherence.*/
125  std::vector<PointCoherencePtr> point_coherences_;
126  };
127 
128  }
129 }
130 
131 #include <pcl/tracking/impl/coherence.hpp>
void compute(const PointCloudInConstPtr &cloud, const IndicesConstPtr &indices, float &w_i)
compute coherence between two pointclouds.
Definition: coherence.hpp:49
double calcPointCoherence(PointInT &source, PointInT &target)
Definition: coherence.hpp:19
PointCloudCoherence()
Constructor.
Definition: coherence.h:71
double compute(PointInT &source, PointInT &target)
compute coherence from the source point to the target point.
Definition: coherence.hpp:13
PointCloudInConstPtr target_input_
a pointer to target point cloud
Definition: coherence.h:122
virtual void computeCoherence(const PointCloudInConstPtr &cloud, const IndicesConstPtr &indices, float &w_j)=0
Abstract method to compute coherence.
virtual double computeCoherence(PointInT &source, PointInT &target)=0
abstract method to calculate coherence.
const std::string & getClassName() const
Get a string representation of the name of this class.
Definition: coherence.h:50
shared_ptr< const Indices > IndicesConstPtr
Definition: pcl_base.h:62
std::string coherence_name_
The coherence name.
Definition: coherence.h:119
shared_ptr< PointCoherence< PointInT > > Ptr
Definition: coherence.h:19
shared_ptr< const PointCoherence< PointInT > > ConstPtr
Definition: coherence.h:20
std::vector< PointCoherencePtr > getPointCoherences()
get a list of pcl::tracking::PointCoherence.
Definition: coherence.h:83
void addPointCoherence(PointCoherencePtr coherence)
add a PointCoherence to the PointCloudCoherence.
Definition: coherence.h:98
typename PointCloudIn::Ptr PointCloudInPtr
Definition: coherence.h:66
shared_ptr< PointCloud< PointInT > > Ptr
Definition: point_cloud.h:428
typename PointCoherence< PointInT >::Ptr PointCoherencePtr
Definition: coherence.h:69
PointCoherence()
empty constructor
Definition: coherence.h:24
PointCoherence is a base class to compute coherence between the two points.
Definition: coherence.h:16
void setPointCoherences(std::vector< PointCoherencePtr > coherences)
set a list of pcl::tracking::PointCoherence.
Definition: coherence.h:89
virtual ~PointCloudCoherence()
Destructor.
Definition: coherence.h:74
shared_ptr< const PointCloud< PointInT > > ConstPtr
Definition: point_cloud.h:429
shared_ptr< PointCloudCoherence< PointInT > > Ptr
Definition: coherence.h:62
std::vector< PointCoherencePtr > point_coherences_
a list of pointers to PointCoherence.
Definition: coherence.h:125
PointCloudCoherence is a base class to compute coherence between the two PointClouds.
Definition: coherence.h:59
virtual void setTargetCloud(const PointCloudInConstPtr &cloud)
add a PointCoherence to the PointCloudCoherence.
Definition: coherence.h:104
typename PointCloudIn::ConstPtr PointCloudInConstPtr
Definition: coherence.h:67
std::string coherence_name_
The coherence name.
Definition: coherence.h:39
const std::string & getClassName() const
Get a string representation of the name of this class.
Definition: coherence.h:115
virtual ~PointCoherence()
empty distructor
Definition: coherence.h:27
shared_ptr< const PointCloudCoherence< PointInT > > ConstPtr
Definition: coherence.h:63
virtual bool initCompute()
This method should get called before starting the actual computation.
Definition: coherence.hpp:36