Point Cloud Library (PCL)  1.14.1-dev
distance_coherence.h
1 #pragma once
2 
3 #include <pcl/tracking/coherence.h>
4 #include <pcl/memory.h>
5 
6 namespace pcl {
7 namespace tracking {
8 /** \brief @b DistanceCoherence computes coherence between two points from the distance
9  * between them. the coherence is calculated by 1 / (1 + weight * d^2 ).
10  * \author Ryohei Ueda
11  * \ingroup tracking
12  */
13 template <typename PointInT>
14 class DistanceCoherence : public PointCoherence<PointInT> {
15 public:
16  using Ptr = shared_ptr<DistanceCoherence<PointInT>>;
17  using ConstPtr = shared_ptr<const DistanceCoherence<PointInT>>;
18 
19  /** \brief initialize the weight to 1.0. */
20  DistanceCoherence() : PointCoherence<PointInT>() {}
21 
22  /** \brief set the weight of coherence.
23  * \param weight the value of the wehgit.
24  */
25  inline void
26  setWeight(double weight)
27  {
28  weight_ = weight;
29  }
30 
31  /** \brief get the weight of coherence.*/
32  inline double
34  {
35  return weight_;
36  }
37 
38 protected:
39  /** \brief return the distance coherence between the two points.
40  * \param source instance of source point.
41  * \param target instance of target point.
42  */
43  double
44  computeCoherence(PointInT& source, PointInT& target) override;
45 
46  /** \brief the weight of coherence.*/
47  double weight_{1.0};
48 };
49 } // namespace tracking
50 } // namespace pcl
51 
52 #ifdef PCL_NO_PRECOMPILE
53 #include <pcl/tracking/impl/distance_coherence.hpp>
54 #endif
DistanceCoherence computes coherence between two points from the distance between them.
double getWeight()
get the weight of coherence.
void setWeight(double weight)
set the weight of coherence.
DistanceCoherence()
initialize the weight to 1.0.
double computeCoherence(PointInT &source, PointInT &target) override
return the distance coherence between the two points.
double weight_
the weight of coherence.
PointCoherence is a base class to compute coherence between the two points.
Definition: coherence.h:15
shared_ptr< const PointCoherence< PointInT > > ConstPtr
Definition: coherence.h:18
shared_ptr< PointCoherence< PointInT > > Ptr
Definition: coherence.h:17
Defines functions, macros and traits for allocating and using memory.