Point Cloud Library (PCL)  1.11.1
distance_coherence.hpp
1 #ifndef PCL_TRACKING_IMPL_DISTANCE_COHERENCE_H_
2 #define PCL_TRACKING_IMPL_DISTANCE_COHERENCE_H_
3 
4 #include <pcl/tracking/distance_coherence.h>
5 
6 #include <Eigen/Dense>
7 
8 namespace pcl {
9 namespace tracking {
10 template <typename PointInT>
11 double
12 DistanceCoherence<PointInT>::computeCoherence(PointInT& source, PointInT& target)
13 {
14  Eigen::Vector4f p = source.getVector4fMap();
15  Eigen::Vector4f p_dash = target.getVector4fMap();
16  double d = (p - p_dash).norm();
17  return 1.0 / (1.0 + d * d * weight_);
18 }
19 } // namespace tracking
20 } // namespace pcl
21 
22 #define PCL_INSTANTIATE_DistanceCoherence(T) \
23  template class PCL_EXPORTS pcl::tracking::DistanceCoherence<T>;
24 
25 #endif
double computeCoherence(PointInT &source, PointInT &target) override
return the distance coherence between the two points.