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