1 #ifndef PCL_TRACKING_IMPL_NEAREST_PAIR_POINT_CLOUD_COHERENCE_H_
2 #define PCL_TRACKING_IMPL_NEAREST_PAIR_POINT_CLOUD_COHERENCE_H_
4 #include <pcl/search/kdtree.h>
5 #include <pcl/search/organized.h>
6 #include <pcl/tracking/nearest_pair_point_cloud_coherence.h>
12 template <
typename Po
intInT>
void
18 for (
size_t i = 0; i < cloud->points.size (); i++)
20 PointInT input_point = cloud->points[i];
21 std::vector<int> k_indices(1);
22 std::vector<float> k_distances(1);
23 search_->nearestKSearch (input_point, 1, k_indices, k_distances);
24 int k_index = k_indices[0];
25 float k_distance = k_distances[0];
26 if (k_distance < maximum_distance_ * maximum_distance_)
30 PointInT target_point = target_input_->points[k_index];
31 double coherence_val = 1.0;
32 for (
size_t i = 0; i < point_coherences_.size (); i++)
35 double w = coherence->compute (input_point, target_point);
41 w = -
static_cast<float> (val);
44 template <
typename Po
intInT>
bool
49 PCL_ERROR (
"[pcl::%s::initCompute] PointCloudCoherence::Init failed.\n", getClassName ().c_str ());
58 if (new_target_ && target_input_)
60 search_->setInputCloud (target_input_);
69 #define PCL_INSTANTIATE_NearestPairPointCloudCoherence(T) template class PCL_EXPORTS pcl::tracking::NearestPairPointCloudCoherence<T>;