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);
215 FlannSearch (
bool sorted =
true, FlannIndexCreatorPtr creator = FlannIndexCreatorPtr (
new KdTreeIndexCreator ()));
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;
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;
321 dim_ = point_representation->getNumberOfDimensions ();
327 inline PointRepresentationConstPtr
const
372 #define PCL_INSTANTIATE_FlannSearch(T) template class PCL_EXPORTS pcl::search::FlannSearch<T>;
374 #endif // PCL_SEARCH_KDTREE_H_
virtual IndexPtr createIndex(MatrixConstPtr data)
Create a FLANN Index from the input data.
PointCloud::ConstPtr PointCloudConstPtr
int radiusSearch(const PointT &point, double radius, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances, unsigned int max_nn=0) const
Search for all the nearest neighbors of the query point in a given radius.
KdTreeMultiIndexCreator(int trees=4)
virtual IndexPtr createIndex(MatrixConstPtr data)=0
Create a FLANN Index from the input data.
boost::shared_ptr< flann::Matrix< float > > MatrixPtr
This file defines compatibility wrappers for low level I/O functions.
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. ...
PointCloudConstPtr input_
Creates a FLANN KdTreeSingleIndex from the given input data.
FlannSearch(bool sorted=true, FlannIndexCreatorPtr creator=FlannIndexCreatorPtr(new KdTreeIndexCreator()))
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.
virtual IndexPtr createIndex(MatrixConstPtr data)
Create a FLANN Index from the 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.
virtual void setInputCloud(const PointCloudConstPtr &cloud, const IndicesConstPtr &indices=IndicesConstPtr())
Provide a pointer to the input dataset.
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. ...
int nearestKSearch(const PointT &point, int k, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances) const
Search for the k-nearest neighbors for the given query point.
MatrixPtr input_flann_
Input data in FLANN format.
virtual ~FlannSearch()
Destructor for FlannSearch.
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...
virtual IndexPtr createIndex(MatrixConstPtr data)
Create a FLANN Index from the input data.
boost::shared_ptr< const PointRepresentation > PointRepresentationConstPtr
void convertInputToFlannMatrix()
converts the input data to a format usable by FLANN
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...