41 #include <pcl/search/search.h>
42 #include <pcl/common/time.h>
43 #include <pcl/point_representation.h>
48 template<
typename T>
struct L2;
99 template<
typename Po
intT,
typename FlannDistance=flann::L2_Simple <
float> >
107 using Ptr = shared_ptr<FlannSearch<PointT, FlannDistance> >;
108 using ConstPtr = shared_ptr<const FlannSearch<PointT, FlannDistance> >;
117 using IndexPtr = shared_ptr<flann::NNIndex<FlannDistance> >;
163 unsigned int max_leaf_size_;
271 nearestKSearch (
const PointT &point,
int k, Indices &k_indices, std::vector<float> &k_sqr_distances)
const override;
283 std::vector<Indices>& k_indices, std::vector< std::vector<float> >& k_sqr_distances)
const override;
297 Indices &k_indices, std::vector<float> &k_sqr_distances,
298 unsigned int max_nn = 0)
const override;
309 radiusSearch (
const PointCloud& cloud,
const Indices& indices,
double radius, std::vector<Indices>& k_indices,
310 std::vector< std::vector<float> >& k_sqr_distances,
unsigned int max_nn=0)
const override;
319 dim_ = point_representation->getNumberOfDimensions ();
370 #define PCL_INSTANTIATE_FlannSearch(T) template class PCL_EXPORTS pcl::search::FlannSearch<T>;
typename PointRepresentation::ConstPtr PointRepresentationConstPtr
shared_ptr< flann::NNIndex< FlannDistance > > IndexPtr
int nearestKSearch(const PointT &point, int k, Indices &k_indices, std::vector< float > &k_sqr_distances) const override
Search for the k-nearest neighbors for the given query point.
int radiusSearch(const PointT &point, double radius, Indices &k_indices, std::vector< float > &k_sqr_distances, unsigned int max_nn=0) const override
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.
shared_ptr< flann::Matrix< float > > MatrixPtr
virtual ~FlannIndexCreator()
destructor
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()))
void setInputCloud(const PointCloudConstPtr &cloud, const IndicesConstPtr &indices=IndicesConstPtr()) override
Provide a pointer to the input dataset.
bool input_copied_for_flann_
shared_ptr< const Indices > IndicesConstPtr
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.
shared_ptr< FlannSearch< PointT, FlannDistance > > Ptr
PointRepresentation provides a set of methods for converting a point structs/object into an n-dimensi...
typename Search< PointT >::PointCloudConstPtr PointCloudConstPtr
shared_ptr< const PointRepresentation< PointT > > ConstPtr
shared_ptr< FlannIndexCreator > FlannIndexCreatorPtr
Creates a FLANN KdTreeIndex of multiple randomized trees from the given input data, suitable for feature matching.
PointRepresentationConstPtr const getPointRepresentation()
Get a pointer to the point representation used when converting points into k-D vectors.
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. ...
shared_ptr< const flann::Matrix< float > > MatrixConstPtr
MatrixPtr input_flann_
Input data in FLANN format.
typename Search< PointT >::PointCloud PointCloud
~FlannSearch()
Destructor for FlannSearch.
int getChecks()
Get the number of checks to perform during approximate searches in multiple randomized trees...
IndexPtr createIndex(MatrixConstPtr data) override
Create a FLANN Index from the input data.
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.
void convertInputToFlannMatrix()
converts the input data to a format usable by FLANN
~KdTreeIndexCreator()
Empty destructor.
A point structure representing Euclidean xyz coordinates, and the RGB color.
virtual ~KdTreeMultiIndexCreator()
Empty destructor.
shared_ptr< PointRepresentation< PointT > > Ptr
typename PointRepresentation::Ptr PointRepresentationPtr
KdTreeIndexCreator(unsigned int max_leaf_size=15)
shared_ptr< const FlannSearch< PointT, FlannDistance > > ConstPtr
typename PointCloud::ConstPtr PointCloudConstPtr
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...