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;
66 template<
typename Po
intT,
typename FlannDistance=flann::L2_Simple <
float> >
72 typedef boost::shared_ptr<std::vector<int> > IndicesPtr;
73 typedef boost::shared_ptr<const std::vector<int> > IndicesConstPtr;
75 typedef boost::shared_ptr<flann::NNIndex <FlannDistance > > IndexPtr;
76 typedef boost::shared_ptr<flann::Matrix <float> > MatrixPtr;
77 typedef boost::shared_ptr<const flann::Matrix <float> > MatrixConstPtr;
81 typedef boost::shared_ptr<const PointRepresentation> PointRepresentationConstPtr;
88 typedef boost::shared_ptr<FlannSearch<PointT, FlannDistance> >
Ptr;
89 typedef boost::shared_ptr<const FlannSearch<PointT, FlannDistance> >
ConstPtr;
103 virtual IndexPtr
createIndex (MatrixConstPtr data)=0;
129 virtual IndexPtr
createIndex (MatrixConstPtr data);
131 unsigned int max_leaf_size_;
152 virtual IndexPtr
createIndex (MatrixConstPtr data);
156 FlannSearch (
bool sorted =
true, FlannIndexCreatorPtr creator = FlannIndexCreatorPtr (
new KdTreeIndexCreator ()));
187 setInputCloud (
const PointCloudConstPtr& cloud,
const IndicesConstPtr& indices = IndicesConstPtr ());
198 nearestKSearch (
const PointT &point,
int k, std::vector<int> &k_indices, std::vector<float> &k_sqr_distances)
const;
209 nearestKSearch (
const PointCloud& cloud,
const std::vector<int>& indices,
int k,
210 std::vector< std::vector<int> >& k_indices, std::vector< std::vector<float> >& k_sqr_distances)
const;
224 std::vector<int> &k_indices, std::vector<float> &k_sqr_distances,
225 unsigned int max_nn = 0)
const;
236 radiusSearch (
const PointCloud& cloud,
const std::vector<int>& indices,
double radius, std::vector< std::vector<int> >& k_indices,
237 std::vector< std::vector<float> >& k_sqr_distances,
unsigned int max_nn=0)
const;
246 dim_ = point_representation->getNumberOfDimensions ();
252 inline PointRepresentationConstPtr
const
292 #define PCL_INSTANTIATE_FlannSearch(T) template class PCL_EXPORTS pcl::search::FlannSearch<T>;
294 #endif // PCL_SEARCH_KDTREE_H_
virtual IndexPtr createIndex(MatrixConstPtr data)=0
Create a FLANN Index from the input data.
Creates a FLANN KdTreeSingleIndex from the given input data.
PointRepresentationConstPtr point_representation_
std::vector< int > index_mapping_
void setPointRepresentation(const PointRepresentationConstPtr &point_representation)
Provide a pointer to the point representation to use to convert points into k-D vectors.
KdTreeIndexCreator(unsigned int max_leaf_size=15)
virtual IndexPtr createIndex(MatrixConstPtr data)
Create a FLANN Index from the input data.
search::FlannSearch is a generic FLANN wrapper class for the new search interface.
Creates a FLANN KdTreeSingleIndex from the given input data.
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.
virtual ~FlannSearch()
Destructor for FlannSearch.
double getEpsilon()
Get the search epsilon precision (error bound) for nearest neighbors searches.
float eps_
Epsilon for approximate NN search.
virtual ~FlannIndexCreator()
destructor
Helper class that creates a FLANN index from a given FLANN matrix.
FlannSearch(bool sorted=true, FlannIndexCreatorPtr creator=FlannIndexCreatorPtr(new KdTreeIndexCreator()))
bool input_copied_for_flann_
PointCloudConstPtr input_
void setEpsilon(double eps)
Set the search epsilon precision (error bound) for nearest neighbors searches.
virtual IndexPtr createIndex(MatrixConstPtr data)
Create a FLANN Index from the input data.
PointRepresentationConstPtr const getPointRepresentation()
Get a pointer to the point representation used when converting points into k-D vectors.
boost::shared_ptr< const FlannSearch< PointT, FlannDistance > > ConstPtr
virtual void setInputCloud(const PointCloudConstPtr &cloud, const IndicesConstPtr &indices=IndicesConstPtr())
Provide a pointer to the input dataset.
boost::shared_ptr< FlannIndexCreator > FlannIndexCreatorPtr
virtual ~KMeansIndexCreator()
Empty destructor.
A point structure representing Euclidean xyz coordinates, and the RGB color.
IndexPtr index_
The FLANN index.
FlannIndexCreatorPtr creator_
The index creator, used to (re-) create the index when the search data is passed. ...
PointCloud represents the base class in PCL for storing collections of 3D points. ...
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.
virtual ~KdTreeIndexCreator()
Empty destructor.
boost::shared_ptr< FlannSearch< PointT, FlannDistance > > Ptr
void convertInputToFlannMatrix()
converts the input data to a format usable by FLANN
PointRepresentation provides a set of methods for converting a point structs/object into an n-dimensi...
MatrixPtr input_flann_
Input data in FLANN format.