Point Cloud Library (PCL)
1.15.1
Toggle main menu visibility
Loading...
Searching...
No Matches
pcl
tracking
impl
coherence.hpp
1
#ifndef PCL_TRACKING_IMPL_COHERENCE_H_
2
#define PCL_TRACKING_IMPL_COHERENCE_H_
3
4
#include <pcl/console/print.h>
5
#include <pcl/tracking/coherence.h>
6
7
namespace
pcl
{
8
namespace
tracking
{
9
10
template
<
typename
Po
int
InT>
11
double
12
PointCoherence<PointInT>::compute
(PointInT& source, PointInT& target)
13
{
14
return
computeCoherence
(source, target);
15
}
16
17
template
<
typename
Po
int
InT>
18
double
19
PointCloudCoherence<PointInT>::calcPointCoherence
(PointInT& source, PointInT& target)
20
{
21
double
val = 0.0;
22
for
(std::size_t i = 0; i <
point_coherences_
.size(); i++) {
23
PointCoherencePtr
coherence =
point_coherences_
[i];
24
double
d = std::log(coherence->compute(source, target));
25
// double d = coherence->compute (source, target);
26
if
(!std::isnan(d))
27
val += d;
28
else
29
PCL_WARN(
"nan!\n"
);
30
}
31
return
val;
32
}
33
34
template
<
typename
Po
int
InT>
35
bool
36
PointCloudCoherence<PointInT>::initCompute
()
37
{
38
if
(!
target_input_
||
target_input_
->points.empty()) {
39
PCL_ERROR(
"[pcl::%s::compute] target_input_ is empty!\n"
,
getClassName
().c_str());
40
return
false
;
41
}
42
43
return
true
;
44
}
45
46
template
<
typename
Po
int
InT>
47
void
48
PointCloudCoherence<PointInT>::compute
(
const
PointCloudInConstPtr
& cloud,
49
const
IndicesConstPtr
& indices,
50
float
& w)
51
{
52
if
(!
initCompute
()) {
53
PCL_ERROR(
"[pcl::%s::compute] Init failed.\n"
,
getClassName
().c_str());
54
return
;
55
}
56
computeCoherence
(cloud, indices, w);
57
}
58
}
// namespace tracking
59
}
// namespace pcl
60
61
#endif
pcl::tracking::PointCloudCoherence::target_input_
PointCloudInConstPtr target_input_
a pointer to target point cloud
Definition
coherence.h:141
pcl::tracking::PointCloudCoherence::getClassName
const std::string & getClassName() const
Get a string representation of the name of this class.
Definition
coherence.h:132
pcl::tracking::PointCloudCoherence::initCompute
virtual bool initCompute()
This method should get called before starting the actual computation.
Definition
coherence.hpp:36
pcl::tracking::PointCloudCoherence::PointCloudInConstPtr
typename PointCloudIn::ConstPtr PointCloudInConstPtr
Definition
coherence.h:66
pcl::tracking::PointCloudCoherence::PointCoherencePtr
typename PointCoherence< PointInT >::Ptr PointCoherencePtr
Definition
coherence.h:68
pcl::tracking::PointCloudCoherence::calcPointCoherence
double calcPointCoherence(PointInT &source, PointInT &target)
Definition
coherence.hpp:19
pcl::tracking::PointCloudCoherence::point_coherences_
std::vector< PointCoherencePtr > point_coherences_
a list of pointers to PointCoherence.
Definition
coherence.h:144
pcl::tracking::PointCloudCoherence::computeCoherence
virtual void computeCoherence(const PointCloudInConstPtr &cloud, const IndicesConstPtr &indices, float &w_j)=0
Abstract method to compute coherence.
pcl::tracking::PointCloudCoherence::compute
void compute(const PointCloudInConstPtr &cloud, const IndicesConstPtr &indices, float &w_i)
compute coherence between two pointclouds.
Definition
coherence.hpp:48
pcl::tracking::PointCoherence::compute
double compute(PointInT &source, PointInT &target)
compute coherence from the source point to the target point.
Definition
coherence.hpp:12
pcl::tracking::PointCoherence::computeCoherence
virtual double computeCoherence(PointInT &source, PointInT &target)=0
abstract method to calculate coherence.
pcl::tracking
Definition
approx_nearest_pair_point_cloud_coherence.h:7
pcl
Definition
convolution.h:46
pcl::IndicesConstPtr
shared_ptr< const Indices > IndicesConstPtr
Definition
pcl_base.h:59