Point Cloud Library (PCL)  1.11.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 
21  using PointCloudInConstPtr =
24 
25  using Ptr = shared_ptr<NearestPairPointCloudCoherence<PointInT>>;
26  using ConstPtr = shared_ptr<const NearestPairPointCloudCoherence<PointInT>>;
29 
30  /** \brief empty constructor */
32  : new_target_(false), search_(), maximum_distance_(std::numeric_limits<double>::max())
33  {
34  coherence_name_ = "NearestPairPointCloudCoherence";
35  }
36 
37  /** \brief Provide a pointer to a dataset to add additional information
38  * to estimate the features for every point in the input dataset. This
39  * is optional, if this is not set, it will only use the data in the
40  * input cloud to estimate the features. This is useful when you only
41  * need to compute the features for a downsampled cloud.
42  * \param search a pointer to a PointCloud message
43  */
44  inline void
45  setSearchMethod(const SearchPtr& search)
46  {
47  search_ = search;
48  }
49 
50  /** \brief Get a pointer to the point cloud dataset. */
51  inline SearchPtr
53  {
54  return (search_);
55  }
56 
57  /** \brief add a PointCoherence to the PointCloudCoherence.
58  * \param[in] cloud coherence a pointer to PointCoherence.
59  */
60  inline void
61  setTargetCloud(const PointCloudInConstPtr& cloud) override
62  {
63  new_target_ = true;
65  }
66 
67  /** \brief set maximum distance to be taken into account.
68  * \param[in] val maximum distance.
69  */
70  inline void
71  setMaximumDistance(double val)
72  {
73  maximum_distance_ = val;
74  }
75 
76 protected:
78 
79  /** \brief This method should get called before starting the actual
80  * computation. */
81  bool
82  initCompute() override;
83 
84  /** \brief A flag which is true if target_input_ is updated */
86 
87  /** \brief A pointer to the spatial search object. */
89 
90  /** \brief max of distance for points to be taken into account*/
92 
93  /** \brief compute the nearest pairs and compute coherence using
94  * point_coherences_ */
95  void
97  const IndicesConstPtr& indices,
98  float& w_j) override;
99 };
100 } // namespace tracking
101 } // namespace pcl
102 
103 // #include <pcl/tracking/impl/nearest_pair_point_cloud_coherence.hpp>
104 #ifdef PCL_NO_PRECOMPILE
105 #include <pcl/tracking/impl/nearest_pair_point_cloud_coherence.hpp>
106 #endif
pcl
Definition: convolution.h:46
pcl::search::Search::ConstPtr
shared_ptr< const pcl::search::Search< PointT > > ConstPtr
Definition: search.h:82
pcl::tracking::PointCloudCoherence::ConstPtr
shared_ptr< const PointCloudCoherence< PointInT > > ConstPtr
Definition: coherence.h:62
pcl::tracking::NearestPairPointCloudCoherence::SearchPtr
typename pcl::search::Search< PointInT >::Ptr SearchPtr
Definition: nearest_pair_point_cloud_coherence.h:27
pcl::IndicesConstPtr
shared_ptr< const Indices > IndicesConstPtr
Definition: pcl_base.h:59
pcl::tracking::PointCloudCoherence::PointCoherencePtr
typename PointCoherence< PointInT >::Ptr PointCoherencePtr
Definition: coherence.h:68
pcl::tracking::NearestPairPointCloudCoherence::getSearchMethod
SearchPtr getSearchMethod()
Get a pointer to the point cloud dataset.
Definition: nearest_pair_point_cloud_coherence.h:52
pcl::tracking::NearestPairPointCloudCoherence::initCompute
bool initCompute() override
This method should get called before starting the actual computation.
Definition: nearest_pair_point_cloud_coherence.hpp:41
pcl::tracking::PointCloudCoherence::coherence_name_
std::string coherence_name_
The coherence name.
Definition: coherence.h:138
pcl::tracking::NearestPairPointCloudCoherence::SearchConstPtr
typename pcl::search::Search< PointInT >::ConstPtr SearchConstPtr
Definition: nearest_pair_point_cloud_coherence.h:28
pcl::tracking::NearestPairPointCloudCoherence::computeCoherence
void computeCoherence(const PointCloudInConstPtr &cloud, const IndicesConstPtr &indices, float &w_j) override
compute the nearest pairs and compute coherence using point_coherences_
Definition: nearest_pair_point_cloud_coherence.hpp:11
pcl::tracking::NearestPairPointCloudCoherence::setSearchMethod
void setSearchMethod(const SearchPtr &search)
Provide a pointer to a dataset to add additional information to estimate the features for every point...
Definition: nearest_pair_point_cloud_coherence.h:45
pcl::tracking::NearestPairPointCloudCoherence::NearestPairPointCloudCoherence
NearestPairPointCloudCoherence()
empty constructor
Definition: nearest_pair_point_cloud_coherence.h:31
pcl::tracking::NearestPairPointCloudCoherence
NearestPairPointCloudCoherence computes coherence between two pointclouds using the nearest point pai...
Definition: nearest_pair_point_cloud_coherence.h:14
pcl::search::Search::Ptr
shared_ptr< pcl::search::Search< PointT > > Ptr
Definition: search.h:81
pcl::tracking::NearestPairPointCloudCoherence::search_
SearchPtr search_
A pointer to the spatial search object.
Definition: nearest_pair_point_cloud_coherence.h:88
pcl::tracking::PointCloudCoherence::PointCloudInConstPtr
typename PointCloudIn::ConstPtr PointCloudInConstPtr
Definition: coherence.h:66
pcl::tracking::NearestPairPointCloudCoherence::setMaximumDistance
void setMaximumDistance(double val)
set maximum distance to be taken into account.
Definition: nearest_pair_point_cloud_coherence.h:71
pcl::tracking::PointCloudCoherence
PointCloudCoherence is a base class to compute coherence between the two PointClouds.
Definition: coherence.h:59
pcl::tracking::NearestPairPointCloudCoherence::new_target_
bool new_target_
A flag which is true if target_input_ is updated.
Definition: nearest_pair_point_cloud_coherence.h:85
pcl::tracking::PointCloudCoherence::Ptr
shared_ptr< PointCloudCoherence< PointInT > > Ptr
Definition: coherence.h:61
pcl::tracking::NearestPairPointCloudCoherence::maximum_distance_
double maximum_distance_
max of distance for points to be taken into account
Definition: nearest_pair_point_cloud_coherence.h:91
pcl::tracking::PointCloudCoherence::setTargetCloud
virtual void setTargetCloud(const PointCloudInConstPtr &cloud)
add a PointCoherence to the PointCloudCoherence.
Definition: coherence.h:115
pcl::tracking::NearestPairPointCloudCoherence::setTargetCloud
void setTargetCloud(const PointCloudInConstPtr &cloud) override
add a PointCoherence to the PointCloudCoherence.
Definition: nearest_pair_point_cloud_coherence.h:61