Point Cloud Library (PCL)
1.7.0
|
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 { 00012 /** \brief @b NearestPairPointCloudCoherence computes coherence between two pointclouds using the 00013 nearest point pairs. 00014 * \author Ryohei Ueda 00015 * \ingroup tracking 00016 */ 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 00034 /** \brief empty constructor */ 00035 NearestPairPointCloudCoherence () 00036 : new_target_ (false) 00037 , search_ () 00038 , maximum_distance_ (std::numeric_limits<double>::max ()) 00039 { 00040 coherence_name_ = "NearestPairPointCloudCoherence"; 00041 } 00042 00043 /** \brief Provide a pointer to a dataset to add additional information 00044 * to estimate the features for every point in the input dataset. This 00045 * is optional, if this is not set, it will only use the data in the 00046 * input cloud to estimate the features. This is useful when you only 00047 * need to compute the features for a downsampled cloud. 00048 * \param cloud a pointer to a PointCloud message 00049 */ 00050 inline void 00051 setSearchMethod (const SearchPtr &search) { search_ = search; } 00052 00053 /** \brief Get a pointer to the point cloud dataset. */ 00054 inline SearchPtr 00055 getSearchMethod () { return (search_); } 00056 00057 /** \brief add a PointCoherence to the PointCloudCoherence. 00058 * \param[in] cloud coherence a pointer to PointCoherence. 00059 */ 00060 virtual inline void 00061 setTargetCloud (const PointCloudInConstPtr &cloud) 00062 { 00063 new_target_ = true; 00064 PointCloudCoherence<PointInT>::setTargetCloud (cloud); 00065 } 00066 00067 /** \brief set maximum distance to be taken into account. 00068 * \param[in] val maximum distance. 00069 */ 00070 inline void setMaximumDistance (double val) { maximum_distance_ = val; } 00071 00072 protected: 00073 using PointCloudCoherence<PointInT>::point_coherences_; 00074 00075 /** \brief This method should get called before starting the actual computation. */ 00076 virtual bool initCompute (); 00077 00078 /** \brief A flag which is true if target_input_ is updated */ 00079 bool new_target_; 00080 00081 /** \brief A pointer to the spatial search object. */ 00082 SearchPtr search_; 00083 00084 /** \brief max of distance for points to be taken into account*/ 00085 double maximum_distance_; 00086 00087 /** \brief compute the nearest pairs and compute coherence using point_coherences_ */ 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 #ifdef PCL_NO_PRECOMPILE 00097 #include <pcl/tracking/impl/nearest_pair_point_cloud_coherence.hpp> 00098 #endif 00099 00100 #endif