pcl::search::FlannSearch< PointT, FlannDistance > Class Template Reference
[Module search]

search::FlannSearch is a generic FLANN wrapper class for the new search interface. More...

#include <pcl/search/flann_search.h>

Inheritance diagram for pcl::search::FlannSearch< PointT, FlannDistance >:
Inheritance graph
[legend]
Collaboration diagram for pcl::search::FlannSearch< PointT, FlannDistance >:
Collaboration graph
[legend]

List of all members.

Classes

class  FlannIndexCreator
 Helper class that creates a FLANN index from a given FLANN matrix. More...
class  KdTreeIndexCreator
 Creates a FLANN KdTreeSingleIndex from the given input data. More...
class  KMeansIndexCreator
 Creates a FLANN KdTreeSingleIndex from the given input data. More...

Public Types

typedef boost::shared_ptr
< FlannSearch< PointT,
FlannDistance > > 
Ptr
typedef boost::shared_ptr
< const FlannSearch< PointT,
FlannDistance > > 
ConstPtr
typedef boost::shared_ptr
< FlannIndexCreator
FlannIndexCreatorPtr

Public Member Functions

 FlannSearch (bool sorted=true, FlannIndexCreatorPtr creator=FlannIndexCreatorPtr(new KdTreeIndexCreator()))
virtual ~FlannSearch ()
 Destructor for FlannSearch.
void setEpsilon (double eps)
 Set the search epsilon precision (error bound) for nearest neighbors searches.
double getEpsilon ()
 Get the search epsilon precision (error bound) for nearest neighbors searches.
virtual void setInputCloud (const PointCloudConstPtr &cloud, const IndicesConstPtr &indices=IndicesConstPtr())
 Provide a pointer to the input dataset.
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 void nearestKSearch (const PointCloud &cloud, const std::vector< int > &indices, int k, std::vector< std::vector< int > > &k_indices, std::vector< std::vector< float > > &k_sqr_distances) const
 Search for the k-nearest neighbors for the given query point.
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 void radiusSearch (const PointCloud &cloud, const std::vector< int > &indices, double radius, std::vector< std::vector< int > > &k_indices, std::vector< std::vector< float > > &k_sqr_distances, unsigned int max_nn=0) const
 Search for the k-nearest neighbors for the given query point.
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.

Protected Member Functions

void convertInputToFlannMatrix ()
 converts the input data to a format usable by FLANN

Protected Attributes

IndexPtr index_
 The FLANN index.
FlannIndexCreatorPtr creator_
 The index creator, used to (re-) create the index when the search data is passed.
MatrixPtr input_flann_
 Input data in FLANN format.
float eps_
 Epsilon for approximate NN search.
bool input_copied_for_flann_
PointRepresentationConstPtr point_representation_
int dim_
std::vector< int > index_mapping_
bool identity_mapping_

Detailed Description

template<typename PointT, typename FlannDistance = flann::L2_Simple <float>>
class pcl::search::FlannSearch< PointT, FlannDistance >

search::FlannSearch is a generic FLANN wrapper class for the new search interface.

It is able to wrap any FLANN index type, e.g. the kd tree as well as indices for high-dimensional searches and intended as a more powerful and cleaner successor to KdTreeFlann.

Author:
Andreas Muetzel

Definition at line 67 of file flann_search.h.


Member Typedef Documentation

template<typename PointT, typename FlannDistance = flann::L2_Simple <float>>
typedef boost::shared_ptr<const FlannSearch<PointT, FlannDistance> > pcl::search::FlannSearch< PointT, FlannDistance >::ConstPtr

Reimplemented from pcl::search::Search< PointT >.

Definition at line 89 of file flann_search.h.

template<typename PointT, typename FlannDistance = flann::L2_Simple <float>>
typedef boost::shared_ptr<FlannIndexCreator> pcl::search::FlannSearch< PointT, FlannDistance >::FlannIndexCreatorPtr

Definition at line 109 of file flann_search.h.

template<typename PointT, typename FlannDistance = flann::L2_Simple <float>>
typedef boost::shared_ptr<FlannSearch<PointT, FlannDistance> > pcl::search::FlannSearch< PointT, FlannDistance >::Ptr

Reimplemented from pcl::search::Search< PointT >.

Definition at line 88 of file flann_search.h.


Constructor & Destructor Documentation

template<typename PointT , typename FlannDistance >
pcl::search::FlannSearch< PointT, FlannDistance >::FlannSearch ( bool  sorted = true,
FlannIndexCreatorPtr  creator = FlannIndexCreatorPtr (new KdTreeIndexCreator ()) 
) [inline]
template<typename PointT , typename FlannDistance >
pcl::search::FlannSearch< PointT, FlannDistance >::~FlannSearch (  )  [inline, virtual]

Member Function Documentation

template<typename PointT , typename FlannDistance >
void pcl::search::FlannSearch< PointT, FlannDistance >::convertInputToFlannMatrix (  )  [inline, protected]
template<typename PointT, typename FlannDistance = flann::L2_Simple <float>>
double pcl::search::FlannSearch< PointT, FlannDistance >::getEpsilon (  )  [inline]

Get the search epsilon precision (error bound) for nearest neighbors searches.

Definition at line 177 of file flann_search.h.

References pcl::search::FlannSearch< PointT, FlannDistance >::eps_.

template<typename PointT, typename FlannDistance = flann::L2_Simple <float>>
PointRepresentationConstPtr const pcl::search::FlannSearch< PointT, FlannDistance >::getPointRepresentation (  )  [inline]

Get a pointer to the point representation used when converting points into k-D vectors.

Definition at line 253 of file flann_search.h.

References pcl::search::FlannSearch< PointT, FlannDistance >::point_representation_.

template<typename PointT, typename FlannDistance >
void pcl::search::FlannSearch< PointT, FlannDistance >::nearestKSearch ( const PointCloud cloud,
const std::vector< int > &  indices,
int  k,
std::vector< std::vector< int > > &  k_indices,
std::vector< std::vector< float > > &  k_sqr_distances 
) const [inline, virtual]

Search for the k-nearest neighbors for the given query point.

Parameters:
[in] cloud the point cloud data
[in] indices a vector of point cloud indices to query for nearest neighbors
[in] k the number of neighbors to search for
[out] k_indices the resultant indices of the neighboring points, k_indices[i] corresponds to the neighbors of the query point i
[out] k_sqr_distances the resultant squared distances to the neighboring points, k_sqr_distances[i] corresponds to the neighbors of the query point i

Reimplemented from pcl::search::Search< PointT >.

Definition at line 133 of file flann_search.hpp.

References pcl::search::FlannSearch< PointT, FlannDistance >::dim_, pcl::search::FlannSearch< PointT, FlannDistance >::eps_, pcl::search::FlannSearch< PointT, FlannDistance >::identity_mapping_, pcl::search::FlannSearch< PointT, FlannDistance >::index_, pcl::search::FlannSearch< PointT, FlannDistance >::index_mapping_, pcl::PointCloud< PointT >::is_dense, pcl::search::FlannSearch< PointT, FlannDistance >::point_representation_, pcl::PointCloud< PointT >::size(), and pcl::search::Search< PointT >::sorted_results_.

template<typename PointT, typename FlannDistance >
int pcl::search::FlannSearch< PointT, FlannDistance >::nearestKSearch ( const PointT point,
int  k,
std::vector< int > &  k_indices,
std::vector< float > &  k_sqr_distances 
) const [inline, virtual]

Search for the k-nearest neighbors for the given query point.

Parameters:
[in] point the given query point
[in] k the number of neighbors to search for
[out] k_indices the resultant indices of the neighboring points (must be resized to k a priori!)
[out] k_sqr_distances the resultant squared distances to the neighboring points (must be resized to k a priori!)
Returns:
number of neighbors found

Implements pcl::search::Search< PointT >.

Definition at line 92 of file flann_search.hpp.

References pcl::search::FlannSearch< PointT, FlannDistance >::eps_, pcl::search::FlannSearch< PointT, FlannDistance >::identity_mapping_, pcl::search::FlannSearch< PointT, FlannDistance >::index_, pcl::search::FlannSearch< PointT, FlannDistance >::index_mapping_, pcl::search::FlannSearch< PointT, FlannDistance >::point_representation_, and pcl::search::Search< PointT >::sorted_results_.

template<typename PointT, typename FlannDistance >
void pcl::search::FlannSearch< PointT, FlannDistance >::radiusSearch ( const PointCloud cloud,
const std::vector< int > &  indices,
double  radius,
std::vector< std::vector< int > > &  k_indices,
std::vector< std::vector< float > > &  k_sqr_distances,
unsigned int  max_nn = 0 
) const [inline, virtual]

Search for the k-nearest neighbors for the given query point.

Parameters:
[in] cloud the point cloud data
[in] indices a vector of point cloud indices to query for nearest neighbors
[in] radius the radius of the sphere bounding all of p_q's neighbors
[out] k_indices the resultant indices of the neighboring points, k_indices[i] corresponds to the neighbors of the query point i
[out] k_sqr_distances the resultant squared distances to the neighboring points, k_sqr_distances[i] corresponds to the neighbors of the query point i
[in] max_nn if given, bounds the maximum returned neighbors to this value

Reimplemented from pcl::search::Search< PointT >.

Definition at line 261 of file flann_search.hpp.

References pcl::search::FlannSearch< PointT, FlannDistance >::dim_, pcl::search::FlannSearch< PointT, FlannDistance >::eps_, pcl::search::FlannSearch< PointT, FlannDistance >::identity_mapping_, pcl::search::FlannSearch< PointT, FlannDistance >::index_, pcl::search::FlannSearch< PointT, FlannDistance >::index_mapping_, pcl::PointCloud< PointT >::is_dense, pcl::search::FlannSearch< PointT, FlannDistance >::point_representation_, pcl::PointCloud< PointT >::size(), and pcl::search::Search< PointT >::sorted_results_.

template<typename PointT, typename FlannDistance >
int pcl::search::FlannSearch< PointT, FlannDistance >::radiusSearch ( const PointT point,
double  radius,
std::vector< int > &  k_indices,
std::vector< float > &  k_sqr_distances,
unsigned int  max_nn = 0 
) const [inline, virtual]

Search for all the nearest neighbors of the query point in a given radius.

Parameters:
[in] point the given query point
[in] radius the radius of the sphere bounding all of p_q's neighbors
[out] k_indices the resultant indices of the neighboring points
[out] k_sqr_distances the resultant squared distances to the neighboring points
[in] max_nn if given, bounds the maximum returned neighbors to this value. If max_nn is set to 0 or to a number higher than the number of points in the input cloud, all neighbors in radius will be returned.
Returns:
number of neighbors found in radius

Implements pcl::search::Search< PointT >.

Definition at line 219 of file flann_search.hpp.

References pcl::search::FlannSearch< PointT, FlannDistance >::eps_, pcl::search::FlannSearch< PointT, FlannDistance >::identity_mapping_, pcl::search::FlannSearch< PointT, FlannDistance >::index_, pcl::search::FlannSearch< PointT, FlannDistance >::index_mapping_, pcl::search::FlannSearch< PointT, FlannDistance >::point_representation_, and pcl::search::Search< PointT >::sorted_results_.

template<typename PointT, typename FlannDistance = flann::L2_Simple <float>>
void pcl::search::FlannSearch< PointT, FlannDistance >::setEpsilon ( double  eps  )  [inline]

Set the search epsilon precision (error bound) for nearest neighbors searches.

Parameters:
[in] eps precision (error bound) for nearest neighbors searches

Definition at line 170 of file flann_search.h.

References pcl::search::FlannSearch< PointT, FlannDistance >::eps_.

template<typename PointT , typename FlannDistance >
void pcl::search::FlannSearch< PointT, FlannDistance >::setInputCloud ( const PointCloudConstPtr &  cloud,
const IndicesConstPtr &  indices = IndicesConstPtr () 
) [inline, virtual]
template<typename PointT, typename FlannDistance = flann::L2_Simple <float>>
void pcl::search::FlannSearch< PointT, FlannDistance >::setPointRepresentation ( const PointRepresentationConstPtr &  point_representation  )  [inline]

Provide a pointer to the point representation to use to convert points into k-D vectors.

Parameters:
[in] point_representation the const boost shared pointer to a PointRepresentation

Definition at line 243 of file flann_search.h.

References pcl::search::FlannSearch< PointT, FlannDistance >::dim_, pcl::search::Search< PointT >::indices_, pcl::search::Search< PointT >::input_, pcl::search::FlannSearch< PointT, FlannDistance >::point_representation_, and pcl::search::FlannSearch< PointT, FlannDistance >::setInputCloud().


Member Data Documentation

template<typename PointT, typename FlannDistance = flann::L2_Simple <float>>
FlannIndexCreatorPtr pcl::search::FlannSearch< PointT, FlannDistance >::creator_ [protected]

The index creator, used to (re-) create the index when the search data is passed.

Definition at line 270 of file flann_search.h.

Referenced by pcl::search::FlannSearch< PointT, FlannDistance >::setInputCloud().

template<typename PointT, typename FlannDistance = flann::L2_Simple <float>>
int pcl::search::FlannSearch< PointT, FlannDistance >::dim_ [protected]
template<typename PointT, typename FlannDistance = flann::L2_Simple <float>>
float pcl::search::FlannSearch< PointT, FlannDistance >::eps_ [protected]
template<typename PointT, typename FlannDistance = flann::L2_Simple <float>>
bool pcl::search::FlannSearch< PointT, FlannDistance >::identity_mapping_ [protected]
template<typename PointT, typename FlannDistance = flann::L2_Simple <float>>
IndexPtr pcl::search::FlannSearch< PointT, FlannDistance >::index_ [protected]
template<typename PointT, typename FlannDistance = flann::L2_Simple <float>>
std::vector<int> pcl::search::FlannSearch< PointT, FlannDistance >::index_mapping_ [protected]
template<typename PointT, typename FlannDistance = flann::L2_Simple <float>>
bool pcl::search::FlannSearch< PointT, FlannDistance >::input_copied_for_flann_ [protected]
template<typename PointT, typename FlannDistance = flann::L2_Simple <float>>
MatrixPtr pcl::search::FlannSearch< PointT, FlannDistance >::input_flann_ [protected]
template<typename PointT, typename FlannDistance = flann::L2_Simple <float>>
PointRepresentationConstPtr pcl::search::FlannSearch< PointT, FlannDistance >::point_representation_ [protected]

The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends