Point Cloud Library (PCL)  1.11.0
nearest_pair_point_cloud_coherence.h
1 #pragma once
2 
3 #include <pcl/search/search.h>
4 
5 #include <pcl/tracking/coherence.h>
6 
7 namespace pcl
8 {
9  namespace tracking
10  {
11  /** \brief @b NearestPairPointCloudCoherence computes coherence between two pointclouds using the
12  nearest point pairs.
13  * \author Ryohei Ueda
14  * \ingroup tracking
15  */
16  template <typename PointInT>
18  {
19  public:
23 
27 
28  using Ptr = shared_ptr<NearestPairPointCloudCoherence<PointInT> >;
29  using ConstPtr = shared_ptr<const NearestPairPointCloudCoherence<PointInT> >;
32 
33  /** \brief empty constructor */
35  : new_target_ (false)
36  , search_ ()
37  , maximum_distance_ (std::numeric_limits<double>::max ())
38  {
39  coherence_name_ = "NearestPairPointCloudCoherence";
40  }
41 
42  /** \brief Provide a pointer to a dataset to add additional information
43  * to estimate the features for every point in the input dataset. This
44  * is optional, if this is not set, it will only use the data in the
45  * input cloud to estimate the features. This is useful when you only
46  * need to compute the features for a downsampled cloud.
47  * \param search a pointer to a PointCloud message
48  */
49  inline void
50  setSearchMethod (const SearchPtr &search) { search_ = search; }
51 
52  /** \brief Get a pointer to the point cloud dataset. */
53  inline SearchPtr
54  getSearchMethod () { return (search_); }
55 
56  /** \brief add a PointCoherence to the PointCloudCoherence.
57  * \param[in] cloud coherence a pointer to PointCoherence.
58  */
59  inline void
60  setTargetCloud (const PointCloudInConstPtr &cloud) override
61  {
62  new_target_ = true;
64  }
65 
66  /** \brief set maximum distance to be taken into account.
67  * \param[in] val maximum distance.
68  */
69  inline void setMaximumDistance (double val) { maximum_distance_ = val; }
70 
71  protected:
73 
74  /** \brief This method should get called before starting the actual computation. */
75  bool initCompute () override;
76 
77  /** \brief A flag which is true if target_input_ is updated */
79 
80  /** \brief A pointer to the spatial search object. */
82 
83  /** \brief max of distance for points to be taken into account*/
85 
86  /** \brief compute the nearest pairs and compute coherence using point_coherences_ */
87  void
88  computeCoherence (const PointCloudInConstPtr &cloud, const IndicesConstPtr &indices, float &w_j) override;
89 
90  };
91  }
92 }
93 
94 // #include <pcl/tracking/impl/nearest_pair_point_cloud_coherence.hpp>
95 #ifdef PCL_NO_PRECOMPILE
96 #include <pcl/tracking/impl/nearest_pair_point_cloud_coherence.hpp>
97 #endif
shared_ptr< const pcl::search::Search< PointT > > ConstPtr
Definition: search.h:82
shared_ptr< pcl::search::Search< PointT > > Ptr
Definition: search.h:81
NearestPairPointCloudCoherence computes coherence between two pointclouds using the nearest point pai...
bool new_target_
A flag which is true if target_input_ is updated.
bool initCompute() override
This method should get called before starting the actual computation.
typename pcl::search::Search< PointInT >::ConstPtr SearchConstPtr
void setMaximumDistance(double val)
set maximum distance to be taken into account.
void setTargetCloud(const PointCloudInConstPtr &cloud) override
add a PointCoherence to the PointCloudCoherence.
SearchPtr getSearchMethod()
Get a pointer to the point cloud dataset.
double maximum_distance_
max of distance for points to be taken into account
typename pcl::search::Search< PointInT >::Ptr SearchPtr
void computeCoherence(const PointCloudInConstPtr &cloud, const IndicesConstPtr &indices, float &w_j) override
compute the nearest pairs and compute coherence using point_coherences_
void setSearchMethod(const SearchPtr &search)
Provide a pointer to a dataset to add additional information to estimate the features for every point...
SearchPtr search_
A pointer to the spatial search object.
PointCloudCoherence is a base class to compute coherence between the two PointClouds.
Definition: coherence.h:60
typename PointCloudIn::ConstPtr PointCloudInConstPtr
Definition: coherence.h:67
typename PointCoherence< PointInT >::Ptr PointCoherencePtr
Definition: coherence.h:69
virtual void setTargetCloud(const PointCloudInConstPtr &cloud)
add a PointCoherence to the PointCloudCoherence.
Definition: coherence.h:104
std::string coherence_name_
The coherence name.
Definition: coherence.h:119
shared_ptr< PointCloudCoherence< PointInT > > Ptr
Definition: coherence.h:62
shared_ptr< const PointCloudCoherence< PointInT > > ConstPtr
Definition: coherence.h:63
shared_ptr< const Indices > IndicesConstPtr
Definition: pcl_base.h:62