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