Point Cloud Library (PCL)  1.14.1-dev
nearest_pair_point_cloud_coherence.h
1 #pragma once
2 
3 #include <pcl/search/search.h>
4 #include <pcl/tracking/coherence.h>
5 
6 namespace pcl {
7 namespace tracking {
8 /** \brief @b NearestPairPointCloudCoherence computes coherence between two pointclouds
9  * using the nearest point pairs.
10  * \author Ryohei Ueda
11  * \ingroup tracking
12  */
13 template <typename PointInT>
15 public:
19 
24 
25  using Ptr = shared_ptr<NearestPairPointCloudCoherence<PointInT>>;
26  using ConstPtr = shared_ptr<const NearestPairPointCloudCoherence<PointInT>>;
29 
30  /** \brief empty constructor */
32  {
33  coherence_name_ = "NearestPairPointCloudCoherence";
34  }
35 
36  /** \brief Provide a pointer to a dataset to add additional information
37  * to estimate the features for every point in the input dataset. This
38  * is optional, if this is not set, it will only use the data in the
39  * input cloud to estimate the features. This is useful when you only
40  * need to compute the features for a downsampled cloud.
41  * \param search a pointer to a PointCloud message
42  */
43  inline void
44  setSearchMethod(const SearchPtr& search)
45  {
46  search_ = search;
47  }
48 
49  /** \brief Get a pointer to the point cloud dataset. */
50  inline SearchPtr
52  {
53  return (search_);
54  }
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
70  setMaximumDistance(double val)
71  {
72  maximum_distance_ = val;
73  }
74 
75 protected:
77 
78  /** \brief This method should get called before starting the actual
79  * computation. */
80  bool
81  initCompute() override;
82 
83  /** \brief A flag which is true if target_input_ is updated */
84  bool new_target_{false};
85 
86  /** \brief A pointer to the spatial search object. */
87  SearchPtr search_{nullptr};
88 
89  /** \brief max of distance for points to be taken into account*/
90  double maximum_distance_{std::numeric_limits<double>::max()};
91 
92  /** \brief compute the nearest pairs and compute coherence using
93  * point_coherences_ */
94  void
96  const IndicesConstPtr& indices,
97  float& w_j) override;
98 };
99 } // namespace tracking
100 } // namespace pcl
101 
102 // #include <pcl/tracking/impl/nearest_pair_point_cloud_coherence.hpp>
103 #ifdef PCL_NO_PRECOMPILE
104 #include <pcl/tracking/impl/nearest_pair_point_cloud_coherence.hpp>
105 #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 PointCloudCoherence< PointInT >::PointCloudInConstPtr PointCloudInConstPtr
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:59
typename PointCloudIn::ConstPtr PointCloudInConstPtr
Definition: coherence.h:66
typename PointCoherence< PointInT >::Ptr PointCoherencePtr
Definition: coherence.h:68
virtual void setTargetCloud(const PointCloudInConstPtr &cloud)
add a PointCoherence to the PointCloudCoherence.
Definition: coherence.h:115
std::string coherence_name_
The coherence name.
Definition: coherence.h:138
shared_ptr< PointCloudCoherence< PointInT > > Ptr
Definition: coherence.h:61
shared_ptr< const PointCloudCoherence< PointInT > > ConstPtr
Definition: coherence.h:62
shared_ptr< const Indices > IndicesConstPtr
Definition: pcl_base.h:59