Point Cloud Library (PCL) 1.15.0
Loading...
Searching...
No Matches
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
7namespace pcl {
8namespace tracking {
9
10template <typename PointInT>
11double
12PointCoherence<PointInT>::compute(PointInT& source, PointInT& target)
13{
14 return computeCoherence(source, target);
15}
16
17template <typename PointInT>
18double
19PointCloudCoherence<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
34template <typename PointInT>
35bool
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
46template <typename PointInT>
47void
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
virtual bool initCompute()
This method should get called before starting the actual computation.
Definition coherence.hpp:36
typename PointCloudIn::ConstPtr PointCloudInConstPtr
Definition coherence.h:66
typename PointCoherence< PointInT >::Ptr PointCoherencePtr
Definition coherence.h:68
double calcPointCoherence(PointInT &source, PointInT &target)
Definition coherence.hpp:19
void compute(const PointCloudInConstPtr &cloud, const IndicesConstPtr &indices, float &w_i)
compute coherence between two pointclouds.
Definition coherence.hpp:48
double compute(PointInT &source, PointInT &target)
compute coherence from the source point to the target point.
Definition coherence.hpp:12
shared_ptr< const Indices > IndicesConstPtr
Definition pcl_base.h:59