39 #ifndef PCL_SEARCH_FLANN_SEARCH_H_ 40 #define PCL_SEARCH_FLANN_SEARCH_H_ 42 #include <pcl/search/search.h> 43 #include <pcl/common/time.h> 44 #include <pcl/point_representation.h> 49 template<
typename T>
struct L2;
100 template<
typename Po
intT,
typename FlannDistance=flann::L2_Simple <
float> >
108 typedef boost::shared_ptr<FlannSearch<PointT, FlannDistance> >
Ptr;
109 typedef boost::shared_ptr<const FlannSearch<PointT, FlannDistance> >
ConstPtr;
117 typedef boost::shared_ptr<flann::Matrix <float> >
MatrixPtr;
121 typedef boost::shared_ptr<flann::NNIndex <FlannDistance > >
IndexPtr;
139 virtual IndexPtr createIndex (MatrixConstPtr data)=0;
165 virtual IndexPtr createIndex (MatrixConstPtr data);
167 unsigned int max_leaf_size_;
188 virtual IndexPtr createIndex (MatrixConstPtr data);
210 virtual IndexPtr createIndex (MatrixConstPtr data);
262 setInputCloud (
const PointCloudConstPtr& cloud,
const IndicesConstPtr& indices = IndicesConstPtr ());
273 nearestKSearch (
const PointT &point,
int k, std::vector<int> &k_indices, std::vector<float> &k_sqr_distances)
const;
284 nearestKSearch (
const PointCloud& cloud,
const std::vector<int>& indices,
int k,
285 std::vector< std::vector<int> >& k_indices, std::vector< std::vector<float> >& k_sqr_distances)
const;
298 radiusSearch (
const PointT& point,
double radius,
299 std::vector<int> &k_indices, std::vector<float> &k_sqr_distances,
300 unsigned int max_nn = 0)
const;
311 radiusSearch (
const PointCloud& cloud,
const std::vector<int>& indices,
double radius, std::vector< std::vector<int> >& k_indices,
312 std::vector< std::vector<float> >& k_sqr_distances,
unsigned int max_nn=0)
const;
320 point_representation_ = point_representation;
321 dim_ = point_representation->getNumberOfDimensions ();
323 setInputCloud (input_, indices_);
327 inline PointRepresentationConstPtr
const 330 return (point_representation_);
337 void convertInputToFlannMatrix();
372 #define PCL_INSTANTIATE_FlannSearch(T) template class PCL_EXPORTS pcl::search::FlannSearch<T>; 374 #endif // PCL_SEARCH_KDTREE_H_ PointCloud::ConstPtr PointCloudConstPtr
KdTreeMultiIndexCreator(int trees=4)
boost::shared_ptr< flann::Matrix< float > > MatrixPtr
virtual ~FlannIndexCreator()
destructor
std::vector< int > index_mapping_
IndexPtr index_
The FLANN index.
FlannIndexCreatorPtr creator_
The index creator, used to (re-) create the index when the search data is passed. ...
Creates a FLANN KdTreeSingleIndex from the given input data.
bool input_copied_for_flann_
Search< PointT >::PointCloudConstPtr PointCloudConstPtr
pcl::PointRepresentation< PointT > PointRepresentation
PointRepresentationConstPtr point_representation_
Creates a FLANN KdTreeSingleIndex from the given input data.
Helper class that creates a FLANN index from a given FLANN matrix.
PointRepresentation provides a set of methods for converting a point structs/object into an n-dimensi...
boost::shared_ptr< const FlannSearch< PointT, FlannDistance > > ConstPtr
boost::shared_ptr< const flann::Matrix< float > > MatrixConstPtr
Creates a FLANN KdTreeIndex of multiple randomized trees from the given input data, suitable for feature matching.
Search< PointT >::PointCloud PointCloud
PointRepresentationConstPtr const getPointRepresentation()
Get a pointer to the point representation used when converting points into k-D vectors.
boost::shared_ptr< std::vector< int > > IndicesPtr
void setPointRepresentation(const PointRepresentationConstPtr &point_representation)
Provide a pointer to the point representation to use to convert points into k-D vectors.
virtual ~KMeansIndexCreator()
Empty destructor.
double getEpsilon()
Get the search epsilon precision (error bound) for nearest neighbors searches.
PointCloud represents the base class in PCL for storing collections of 3D points. ...
MatrixPtr input_flann_
Input data in FLANN format.
flann::NNIndex< FlannDistance > Index
int getChecks()
Get the number of checks to perform during approximate searches in multiple randomized trees...
int checks_
Number of checks to perform for approximate NN search using the multiple randomized tree index...
void setEpsilon(double eps)
Set the search epsilon precision (error bound) for nearest neighbors searches.
void setChecks(int checks)
Set the number of checks to perform during approximate searches in multiple randomized trees...
boost::shared_ptr< const PointRepresentation > PointRepresentationConstPtr
boost::shared_ptr< PointRepresentation > PointRepresentationPtr
A point structure representing Euclidean xyz coordinates, and the RGB color.
virtual ~KdTreeMultiIndexCreator()
Empty destructor.
boost::shared_ptr< FlannSearch< PointT, FlannDistance > > Ptr
boost::shared_ptr< const std::vector< int > > IndicesConstPtr
KdTreeIndexCreator(unsigned int max_leaf_size=15)
virtual ~KdTreeIndexCreator()
Empty destructor.
boost::shared_ptr< FlannIndexCreator > FlannIndexCreatorPtr
boost::shared_ptr< flann::NNIndex< FlannDistance > > IndexPtr
search::FlannSearch is a generic FLANN wrapper class for the new search interface.
float eps_
Epsilon for approximate NN search.
KMeansIndexCreator()
All FLANN kd trees created by this class will have a maximum of max_leaf_size points per leaf node...