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/tracking/nearest_pair_point_cloud_coherence.h>
9 template <
typename Po
intInT>
16 for (std::size_t i = 0; i < cloud->size(); i++) {
17 PointInT input_point = (*cloud)[i];
19 std::vector<float> k_distances(1);
20 search_->nearestKSearch(input_point, 1, k_indices, k_distances);
21 int k_index = k_indices[0];
22 float k_distance = k_distances[0];
23 if (k_distance < maximum_distance_ * maximum_distance_) {
26 PointInT target_point = (*target_input_)[k_index];
27 double coherence_val = 1.0;
28 for (std::size_t i = 0; i < point_coherences_.size(); i++) {
30 double w = coherence->compute(input_point, target_point);
36 w = -
static_cast<float>(val);
39 template <
typename Po
intInT>
44 PCL_ERROR(
"[pcl::%s::initCompute] PointCloudCoherence::Init failed.\n",
45 getClassName().c_str());
54 if (new_target_ && target_input_) {
55 search_->setInputCloud(target_input_);
64 #define PCL_INSTANTIATE_NearestPairPointCloudCoherence(T) \
65 template class PCL_EXPORTS pcl::tracking::NearestPairPointCloudCoherence<T>;
search::KdTree is a wrapper class which inherits the pcl::KdTree class for performing search function...
bool initCompute() override
This method should get called before starting the actual computation.
void computeCoherence(const PointCloudInConstPtr &cloud, const IndicesConstPtr &indices, float &w_j) override
compute the nearest pairs and compute coherence using point_coherences_
PointCloudCoherence is a base class to compute coherence between the two PointClouds.
typename PointCloudIn::ConstPtr PointCloudInConstPtr
typename PointCoherence< PointInT >::Ptr PointCoherencePtr
shared_ptr< const Indices > IndicesConstPtr
IndicesAllocator<> Indices
Type used for indices in PCL.