00001 #ifndef PCL_TRACKING_NEAREST_PAIR_POINT_CLOUD_COHERENCE_H_ 00002 #define PCL_TRACKING_NEAREST_PAIR_POINT_CLOUD_COHERENCE_H_ 00003 00004 #include <pcl/search/search.h> 00005 00006 #include <pcl/tracking/coherence.h> 00007 00008 namespace pcl 00009 { 00010 namespace tracking 00011 { 00017 template <typename PointInT> 00018 class NearestPairPointCloudCoherence: public PointCloudCoherence<PointInT> 00019 { 00020 public: 00021 using PointCloudCoherence<PointInT>::getClassName; 00022 using PointCloudCoherence<PointInT>::coherence_name_; 00023 using PointCloudCoherence<PointInT>::target_input_; 00024 00025 typedef typename PointCloudCoherence<PointInT>::PointCoherencePtr PointCoherencePtr; 00026 typedef typename PointCloudCoherence<PointInT>::PointCloudInConstPtr PointCloudInConstPtr; 00027 typedef PointCloudCoherence<PointInT> BaseClass; 00028 00029 typedef boost::shared_ptr<NearestPairPointCloudCoherence<PointInT> > Ptr; 00030 typedef boost::shared_ptr<const NearestPairPointCloudCoherence<PointInT> > ConstPtr; 00031 typedef boost::shared_ptr<pcl::search::Search<PointInT> > SearchPtr; 00032 typedef boost::shared_ptr<const pcl::search::Search<PointInT> > SearchConstPtr; 00033 00035 NearestPairPointCloudCoherence () 00036 : new_target_ (false) 00037 , search_ () 00038 , maximum_distance_ (std::numeric_limits<double>::max ()) 00039 { 00040 coherence_name_ = "NearestPairPointCloudCoherence"; 00041 } 00042 00050 inline void 00051 setSearchMethod (const SearchPtr &search) { search_ = search; } 00052 00054 inline SearchPtr 00055 getSearchMethod () { return (search_); } 00056 00060 virtual inline void 00061 setTargetCloud (const PointCloudInConstPtr &cloud) 00062 { 00063 new_target_ = true; 00064 PointCloudCoherence<PointInT>::setTargetCloud (cloud); 00065 } 00066 00070 inline void setMaximumDistance (double val) { maximum_distance_ = val; } 00071 00072 protected: 00073 using PointCloudCoherence<PointInT>::point_coherences_; 00074 00076 virtual bool initCompute (); 00077 00079 bool new_target_; 00080 00082 SearchPtr search_; 00083 00085 double maximum_distance_; 00086 00088 virtual void 00089 computeCoherence (const PointCloudInConstPtr &cloud, const IndicesConstPtr &indices, float &w_j); 00090 00091 }; 00092 } 00093 } 00094 00095 // #include <pcl/tracking/impl/nearest_pair_point_cloud_coherence.hpp> 00096 00097 #endif