41 #include <pcl/search/search.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_;
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;
310 std::vector< std::vector<float> >& k_sqr_distances,
unsigned int max_nn=0)
const override;
319 dim_ = point_representation->getNumberOfDimensions ();
373 #include <pcl/search/impl/flann_search.hpp>
375 #define PCL_INSTANTIATE_FlannSearch(T) template class PCL_EXPORTS pcl::search::FlannSearch<T>;
PointCloud represents the base class in PCL for storing collections of 3D points.
PointRepresentation provides a set of methods for converting a point structs/object into an n-dimensi...
shared_ptr< const PointRepresentation< PointT > > ConstPtr
shared_ptr< PointRepresentation< PointT > > Ptr
Helper class that creates a FLANN index from a given FLANN matrix.
virtual IndexPtr createIndex(MatrixConstPtr data)=0
Create a FLANN Index from the input data.
virtual ~FlannIndexCreator()=default
destructor
Creates a FLANN KdTreeSingleIndex from the given input data.
KMeansIndexCreator()=default
All FLANN kd trees created by this class will have a maximum of max_leaf_size points per leaf node.
virtual IndexPtr createIndex(MatrixConstPtr data)
Create a FLANN Index from the input data.
virtual ~KMeansIndexCreator()=default
Empty destructor.
Creates a FLANN KdTreeSingleIndex from the given input data.
~KdTreeIndexCreator() override=default
Empty destructor.
KdTreeIndexCreator(unsigned int max_leaf_size=15)
IndexPtr createIndex(MatrixConstPtr data) override
Create a FLANN Index from the input data.
Creates a FLANN KdTreeIndex of multiple randomized trees from the given input data,...
virtual IndexPtr createIndex(MatrixConstPtr data)
Create a FLANN Index from the input data.
KdTreeMultiIndexCreator(int trees=4)
virtual ~KdTreeMultiIndexCreator()=default
Empty destructor.
search::FlannSearch is a generic FLANN wrapper class for the new search interface.
void setEpsilon(double eps)
Set the search epsilon precision (error bound) for nearest neighbors searches.
void convertInputToFlannMatrix()
converts the input data to a format usable by FLANN
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.
std::size_t total_nr_points_
shared_ptr< flann::NNIndex< FlannDistance > > IndexPtr
int checks_
Number of checks to perform for approximate NN search using the multiple randomized tree index.
double getEpsilon()
Get the search epsilon precision (error bound) for nearest neighbors searches.
shared_ptr< const flann::Matrix< float > > MatrixConstPtr
FlannSearch(bool sorted=true, FlannIndexCreatorPtr creator=FlannIndexCreatorPtr(new KdTreeIndexCreator()))
~FlannSearch() override
Destructor for FlannSearch.
void setChecks(int checks)
Set the number of checks to perform during approximate searches in multiple randomized trees.
MatrixPtr input_flann_
Input data in FLANN format.
bool setInputCloud(const PointCloudConstPtr &cloud, const IndicesConstPtr &indices=IndicesConstPtr()) override
Provide a pointer to the input dataset.
shared_ptr< FlannSearch< PointT, FlannDistance > > Ptr
PointRepresentationConstPtr point_representation_
shared_ptr< FlannIndexCreator > FlannIndexCreatorPtr
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.
typename Search< PointT >::PointCloudConstPtr PointCloudConstPtr
typename Search< PointT >::PointCloud PointCloud
FlannIndexCreatorPtr creator_
The index creator, used to (re-) create the index when the search data is passed.
IndexPtr index_
The FLANN index.
typename PointRepresentation::ConstPtr PointRepresentationConstPtr
int getChecks()
Get the number of checks to perform during approximate searches in multiple randomized trees.
void setPointRepresentation(const PointRepresentationConstPtr &point_representation)
Provide a pointer to the point representation to use to convert points into k-D vectors.
PointRepresentationConstPtr const getPointRepresentation()
Get a pointer to the point representation used when converting points into k-D vectors.
typename PointRepresentation::Ptr PointRepresentationPtr
bool input_copied_for_flann_
float eps_
Epsilon for approximate NN search.
shared_ptr< flann::Matrix< float > > MatrixPtr
shared_ptr< const FlannSearch< PointT, FlannDistance > > ConstPtr
PointCloudConstPtr input_
typename PointCloud::ConstPtr PointCloudConstPtr
Define methods for measuring time spent in code blocks.
shared_ptr< const Indices > IndicesConstPtr
IndicesAllocator<> Indices
Type used for indices in PCL.
A point structure representing Euclidean xyz coordinates, and the RGB color.