pcl::search::OrganizedNeighbor< PointT > Class Template Reference
[Module search]

OrganizedNeighbor is a class for optimized nearest neigbhor search in organized point clouds. More...

#include <pcl/search/organized.h>

Inheritance diagram for pcl::search::OrganizedNeighbor< PointT >:
Inheritance graph
[legend]
Collaboration diagram for pcl::search::OrganizedNeighbor< PointT >:
Collaboration graph
[legend]

List of all members.

Classes

struct  Entry

Public Types

typedef pcl::PointCloud< PointT > PointCloud
typedef boost::shared_ptr
< PointCloud > 
PointCloudPtr
typedef boost::shared_ptr
< const PointCloud > 
PointCloudConstPtr
typedef boost::shared_ptr
< const std::vector< int > > 
IndicesConstPtr
typedef boost::shared_ptr
< pcl::search::OrganizedNeighbor
< PointT > > 
Ptr
typedef boost::shared_ptr
< const
pcl::search::OrganizedNeighbor
< PointT > > 
ConstPtr
typedef boost::shared_ptr
< std::vector< int > > 
IndicesPtr

Public Member Functions

 OrganizedNeighbor (bool sorted_results=false, float eps=1e-4f, unsigned pyramid_level=5)
 Constructor.
virtual ~OrganizedNeighbor ()
 Empty deconstructor.
bool isValid () const
 Test whether this search-object is valid (input is organized AND from projective device) User should use this method after setting the input cloud, since setInput just prints an error if input is not organized or a projection matrix could not be determined.
void computeCameraMatrix (Eigen::Matrix3f &camera_matrix) const
 Compute the camera matrix.
virtual void setInputCloud (const PointCloudConstPtr &cloud, const IndicesConstPtr &indices=IndicesConstPtr())
 Provide a pointer to the input data set, if user has focal length he must set it before calling this.
int radiusSearch (const PointT &p_q, double radius, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances, unsigned int max_nn=0) const
 Search for all neighbors of query point that are within a given radius.
void estimateProjectionMatrix ()
 estimated the projection matrix from the input cloud.
int nearestKSearch (const PointT &p_q, int k, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances) const
 Search for the k-nearest neighbors for a given query point.
bool projectPoint (const PointT &p, pcl::PointXY &q) const
 projects a point into the image
virtual const std::string & getName () const
 returns the search method name
virtual void setSortedResults (bool sorted)
 sets whether the results should be sorted (ascending in the distance) or not
virtual void setInputCloud (const PointCloudConstPtr &cloud, const IndicesConstPtr &indices=IndicesConstPtr())
 Pass the input dataset that the search will be performed on.
virtual PointCloudConstPtr getInputCloud () const
 Get a pointer to the input point cloud dataset.
virtual IndicesConstPtr getIndices () const
 Get a pointer to the vector of indices used.
virtual int nearestKSearch (const PointCloud &cloud, int index, int k, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances) const
 Search for k-nearest neighbors for the given query point.
virtual int nearestKSearch (int index, int k, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances) const
 Search for k-nearest neighbors for the given query point (zero-copy).
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.
template<typename PointTDiff >
int nearestKSearchT (const PointTDiff &point, int k, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances) const
 Search for k-nearest neighbors for the given query point.
template<typename PointTDiff >
void nearestKSearchT (const pcl::PointCloud< PointTDiff > &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.
virtual int radiusSearch (const PointCloud &cloud, int index, 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 int radiusSearch (int index, 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 (zero-copy).
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 all the nearest neighbors of the query point in a given radius.
template<typename PointTDiff >
int radiusSearchT (const PointTDiff &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.
template<typename PointTDiff >
void radiusSearchT (const pcl::PointCloud< PointTDiff > &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 all the nearest neighbors of the query points in a given radius.

Detailed Description

template<typename PointT>
class pcl::search::OrganizedNeighbor< PointT >

OrganizedNeighbor is a class for optimized nearest neigbhor search in organized point clouds.

Author:
Radu B. Rusu, Julius Kammerl, Suat Gedikli, Koen Buys

Definition at line 61 of file organized.h.


Member Typedef Documentation

template<typename PointT>
typedef boost::shared_ptr<const pcl::search::OrganizedNeighbor<PointT> > pcl::search::OrganizedNeighbor< PointT >::ConstPtr

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

Definition at line 73 of file organized.h.

template<typename PointT>
typedef boost::shared_ptr<const std::vector<int> > pcl::search::OrganizedNeighbor< PointT >::IndicesConstPtr

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

Definition at line 70 of file organized.h.

template<typename PointT>
typedef boost::shared_ptr<std::vector<int> > pcl::search::Search< PointT >::IndicesPtr [inherited]
template<typename PointT>
typedef pcl::PointCloud<PointT> pcl::search::OrganizedNeighbor< PointT >::PointCloud

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

Definition at line 66 of file organized.h.

template<typename PointT>
typedef boost::shared_ptr<const PointCloud> pcl::search::OrganizedNeighbor< PointT >::PointCloudConstPtr

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

Definition at line 69 of file organized.h.

template<typename PointT>
typedef boost::shared_ptr<PointCloud> pcl::search::OrganizedNeighbor< PointT >::PointCloudPtr

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

Definition at line 67 of file organized.h.

template<typename PointT>
typedef boost::shared_ptr<pcl::search::OrganizedNeighbor<PointT> > pcl::search::OrganizedNeighbor< PointT >::Ptr

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

Definition at line 72 of file organized.h.


Constructor & Destructor Documentation

template<typename PointT>
pcl::search::OrganizedNeighbor< PointT >::OrganizedNeighbor ( bool  sorted_results = false,
float  eps = 1e-4f,
unsigned  pyramid_level = 5 
) [inline]

Constructor.

Parameters:
[in] sorted_results whether the results should be return sorted in ascending order on the distances or not. This applies only for radius search, since knn always returns sorted resutls
[in] eps the threshold for the mean-squared-error of the estimation of the projection matrix. if the MSE is above this value, the point cloud is considered as not from a projective device, thus organized neighbor search can not be applied on that cloud.
[in] pyramid_level the level of the down sampled point cloud to be used for projection matrix estimation

Definition at line 87 of file organized.h.

template<typename PointT>
virtual pcl::search::OrganizedNeighbor< PointT >::~OrganizedNeighbor (  )  [inline, virtual]

Empty deconstructor.

Definition at line 99 of file organized.h.


Member Function Documentation

template<typename PointT >
void pcl::search::OrganizedNeighbor< PointT >::computeCameraMatrix ( Eigen::Matrix3f &  camera_matrix  )  const [inline]

Compute the camera matrix.

Parameters:
[out] camera_matrix the resultant computed camera matrix

Definition at line 345 of file organized.hpp.

template<typename PointT >
void pcl::search::OrganizedNeighbor< PointT >::estimateProjectionMatrix (  )  [inline]

estimated the projection matrix from the input cloud.

Definition at line 372 of file organized.hpp.

template<typename PointT>
virtual IndicesConstPtr pcl::search::Search< PointT >::getIndices (  )  const [inline, virtual, inherited]

Get a pointer to the vector of indices used.

Definition at line 139 of file search.h.

template<typename PointT>
virtual PointCloudConstPtr pcl::search::Search< PointT >::getInputCloud (  )  const [inline, virtual, inherited]

Get a pointer to the input point cloud dataset.

Definition at line 132 of file search.h.

template<typename PointT>
virtual const std::string& pcl::search::Search< PointT >::getName (  )  const [inline, virtual, inherited]

returns the search method name

Definition at line 104 of file search.h.

template<typename PointT>
bool pcl::search::OrganizedNeighbor< PointT >::isValid (  )  const [inline]

Test whether this search-object is valid (input is organized AND from projective device) User should use this method after setting the input cloud, since setInput just prints an error if input is not organized or a projection matrix could not be determined.

Returns:
true if the input data is organized and from a projective device, false otherwise

Definition at line 107 of file organized.h.

template<typename PointT>
virtual void pcl::search::Search< PointT >::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, inherited]

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 in pcl::search::FlannSearch< PointT, FlannDistance >.

Definition at line 245 of file search.h.

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

Search for k-nearest neighbors for the given query point (zero-copy).

Attention:
This method does not do any bounds checking for the input index (i.e., index >= cloud.points.size () || index < 0), and assumes valid (i.e., finite) data.
Parameters:
[in] index a valid index representing a valid query point in the dataset given by setInputCloud. If indices were given in setInputCloud, index will be the position in the indices vector.
[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
Exceptions:
asserts in debug mode if the index is not between 0 and the maximum number of points

Reimplemented in pcl::search::Octree< PointT, LeafTWrap, BranchTWrap, OctreeT >.

Definition at line 220 of file search.h.

template<typename PointT>
virtual int pcl::search::Search< PointT >::nearestKSearch ( const PointCloud &  cloud,
int  index,
int  k,
std::vector< int > &  k_indices,
std::vector< float > &  k_sqr_distances 
) const [inline, virtual, inherited]

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

Attention:
This method does not do any bounds checking for the input index (i.e., index >= cloud.points.size () || index < 0), and assumes valid (i.e., finite) data.
Parameters:
[in] cloud the point cloud data
[in] index a valid index in cloud representing a valid (i.e., finite) 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
Exceptions:
asserts in debug mode if the index is not between 0 and the maximum number of points

Reimplemented in pcl::search::Octree< PointT, LeafTWrap, BranchTWrap, OctreeT >.

Definition at line 195 of file search.h.

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

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

Note:
limiting the maximum search radius (with setMaxDistance) can lead to a significant improvement in search speed
Parameters:
[in] p_q the given query point (setInputCloud must be given a-priori!)
[in] k the number of neighbors to search for (used only if horizontal and vertical window not given already!)
[out] k_indices the resultant point indices (must be resized to k beforehand!)
[out] k_sqr_distances 
Note:
this function does not return distances
Returns:
number of neighbors found

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

Definition at line 113 of file organized.hpp.

template<typename PointT>
template<typename PointTDiff >
void pcl::search::Search< PointT >::nearestKSearchT ( const pcl::PointCloud< PointTDiff > &  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, inherited]

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

Use this method if the query points are of a different type than the points in the data set (e.g. PointXYZRGBA instead of PointXYZ).

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
Note:
This method copies the input point cloud of type PointTDiff to a temporary cloud of type PointT and performs the batch search on the new cloud. You should prefer the single-point search if you don't use a search algorithm that accelerates batch NN search.

Definition at line 273 of file search.h.

template<typename PointT>
template<typename PointTDiff >
int pcl::search::Search< PointT >::nearestKSearchT ( const PointTDiff &  point,
int  k,
std::vector< int > &  k_indices,
std::vector< float > &  k_sqr_distances 
) const [inline, inherited]

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

This method accepts a different template parameter for the point type.

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

Definition at line 166 of file search.h.

template<typename PointT >
bool pcl::search::OrganizedNeighbor< PointT >::projectPoint ( const PointT &  p,
pcl::PointXY &  q 
) const [inline]

projects a point into the image

Parameters:
[in] p point in 3D World Coordinate Frame to be projected onto the image plane
[out] q the 2D projected point in pixel coordinates (u,v)
Returns:
true if projection is valid, false otherwise

Definition at line 517 of file organized.hpp.

template<typename PointT>
virtual void pcl::search::Search< PointT >::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, inherited]

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

Parameters:
[in] cloud the point cloud data
[in] indices the indices in cloud. If indices is empty, neighbors will be searched for all points.
[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. 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.

Reimplemented in pcl::search::FlannSearch< PointT, FlannDistance >.

Definition at line 413 of file search.h.

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

Search for all the nearest neighbors of the query point in a given radius (zero-copy).

Attention:
This method does not do any bounds checking for the input index (i.e., index >= cloud.points.size () || index < 0), and assumes valid (i.e., finite) data.
Parameters:
[in] index a valid index representing a valid query point in the dataset given by setInputCloud. If indices were given in setInputCloud, index will be the position in the indices vector.
[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
Exceptions:
asserts in debug mode if the index is not between 0 and the maximum number of points

Reimplemented in pcl::search::Octree< PointT, LeafTWrap, BranchTWrap, OctreeT >.

Definition at line 387 of file search.h.

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

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

Attention:
This method does not do any bounds checking for the input index (i.e., index >= cloud.points.size () || index < 0), and assumes valid (i.e., finite) data.
Parameters:
[in] cloud the point cloud data
[in] index a valid index in cloud representing a valid (i.e., finite) 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
Exceptions:
asserts in debug mode if the index is not between 0 and the maximum number of points

Reimplemented in pcl::search::Octree< PointT, LeafTWrap, BranchTWrap, OctreeT >.

Definition at line 359 of file search.h.

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

Search for all neighbors of query point that are within a given radius.

Parameters:
[in] p_q 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 50 of file organized.hpp.

template<typename PointT>
template<typename PointTDiff >
void pcl::search::Search< PointT >::radiusSearchT ( const pcl::PointCloud< PointTDiff > &  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, inherited]

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

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. 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.
Note:
This method copies the input point cloud of type PointTDiff to a temporary cloud of type PointT and performs the batch search on the new cloud. You should prefer the single-point search if you don't use a search algorithm that accelerates batch NN search.

Definition at line 449 of file search.h.

template<typename PointT>
template<typename PointTDiff >
int pcl::search::Search< PointT >::radiusSearchT ( const PointTDiff &  point,
double  radius,
std::vector< int > &  k_indices,
std::vector< float > &  k_sqr_distances,
unsigned int  max_nn = 0 
) const [inline, inherited]

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

Definition at line 329 of file search.h.

template<typename PointT>
virtual void pcl::search::Search< PointT >::setInputCloud ( const PointCloudConstPtr &  cloud,
const IndicesConstPtr &  indices = IndicesConstPtr () 
) [inline, virtual, inherited]

Pass the input dataset that the search will be performed on.

Parameters:
[in] cloud a const pointer to the PointCloud data
[in] indices the point indices subset that is to be used from the cloud

Definition at line 124 of file search.h.

template<typename PointT>
virtual void pcl::search::OrganizedNeighbor< PointT >::setInputCloud ( const PointCloudConstPtr &  cloud,
const IndicesConstPtr &  indices = IndicesConstPtr () 
) [inline, virtual]

Provide a pointer to the input data set, if user has focal length he must set it before calling this.

Parameters:
[in] cloud the const boost shared pointer to a PointCloud message
[in] indices the const boost shared pointer to PointIndices

Definition at line 128 of file organized.h.

template<typename PointT>
virtual void pcl::search::Search< PointT >::setSortedResults ( bool  sorted  )  [inline, virtual, inherited]

sets whether the results should be sorted (ascending in the distance) or not

Parameters:
[in] sorted should be true if the results should be sorted by the distance in ascending order. Otherwise the results may be returned in any order.

Reimplemented in pcl::search::KdTree< PointT >.

Definition at line 114 of file search.h.


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

Generated on 16 Oct 2012 for Point Cloud Library (PCL) by  doxygen 1.6.1