OrganizedNeighbor is a class for optimized nearest neigbhor search in organized point clouds. More...
#include <pcl/search/organized.h>
Classes |
|
struct | Entry |
Public Types |
|
using | PointCloud = pcl::PointCloud< PointT > |
using | PointCloudPtr = typename PointCloud::Ptr |
using | PointCloudConstPtr = typename PointCloud::ConstPtr |
using | Ptr = shared_ptr< pcl::search::OrganizedNeighbor< PointT > > |
using | ConstPtr = shared_ptr< const pcl::search::OrganizedNeighbor< PointT > > |
Public Types inherited from pcl::search::Search< PointT > | |
using | PointCloud = pcl::PointCloud< PointT > |
using | PointCloudPtr = typename PointCloud::Ptr |
using | PointCloudConstPtr = typename PointCloud::ConstPtr |
using | Ptr = shared_ptr< pcl::search::Search< PointT > > |
using | ConstPtr = shared_ptr< const pcl::search::Search< PointT > > |
using | IndicesPtr = pcl::IndicesPtr |
using | IndicesConstPtr = pcl::IndicesConstPtr |
Public Member Functions |
|
OrganizedNeighbor (bool sorted_results=false, float eps=1e-4f, unsigned pyramid_level=5) | |
Constructor. More... |
|
~OrganizedNeighbor () | |
Empty deconstructor. More... |
|
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. More... |
|
void | computeCameraMatrix (Eigen::Matrix3f &camera_matrix) const |
Compute the camera matrix. More... |
|
void | setInputCloud (const PointCloudConstPtr &cloud, const IndicesConstPtr &indices=IndicesConstPtr()) override |
Provide a pointer to the input data set, if user has focal length he must set it before calling this. More... |
|
int | radiusSearch (const PointT &p_q, double radius, Indices &k_indices, std::vector< float > &k_sqr_distances, unsigned int max_nn=0) const override |
Search for all neighbors of query point that are within a given radius. More... |
|
void | estimateProjectionMatrix () |
estimated the projection matrix from the input cloud. More... |
|
int | nearestKSearch (const PointT &p_q, int k, Indices &k_indices, std::vector< float > &k_sqr_distances) const override |
Search for the k-nearest neighbors for a given query point. More... |
|
bool | projectPoint (const PointT &p, pcl::PointXY &q) const |
projects a point into the image More... |
|
Public Member Functions inherited from pcl::search::Search< PointT > | |
Search (const std::string &name="", bool sorted=false) | |
Constructor. More... |
|
virtual | ~Search () |
Destructor. More... |
|
virtual const std::string & | getName () const |
Returns the search method name. More... |
|
virtual void | setSortedResults (bool sorted) |
sets whether the results should be sorted (ascending in the distance) or not More... |
|
virtual bool | getSortedResults () |
Gets whether the results should be sorted (ascending in the distance) or not Otherwise the results may be returned in any order. More... |
|
virtual PointCloudConstPtr | getInputCloud () const |
Get a pointer to the input point cloud dataset. More... |
|
virtual IndicesConstPtr | getIndices () const |
Get a pointer to the vector of indices used. More... |
|
template<typename PointTDiff > | |
int | nearestKSearchT (const PointTDiff &point, int k, Indices &k_indices, std::vector< float > &k_sqr_distances) const |
Search for k-nearest neighbors for the given query point. More... |
|
virtual int | nearestKSearch (const PointCloud &cloud, index_t index, int k, Indices &k_indices, std::vector< float > &k_sqr_distances) const |
Search for k-nearest neighbors for the given query point. More... |
|
virtual int | nearestKSearch (index_t index, int k, Indices &k_indices, std::vector< float > &k_sqr_distances) const |
Search for k-nearest neighbors for the given query point (zero-copy). More... |
|
virtual void | nearestKSearch (const PointCloud &cloud, const Indices &indices, int k, std::vector< Indices > &k_indices, std::vector< std::vector< float > > &k_sqr_distances) const |
Search for the k-nearest neighbors for the given query point. More... |
|
template<typename PointTDiff > | |
void | nearestKSearchT (const pcl::PointCloud< PointTDiff > &cloud, const Indices &indices, int k, std::vector< Indices > &k_indices, std::vector< std::vector< float > > &k_sqr_distances) const |
Search for the k-nearest neighbors for the given query point. More... |
|
template<typename PointTDiff > | |
int | radiusSearchT (const PointTDiff &point, double radius, Indices &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. More... |
|
virtual int | radiusSearch (const PointCloud &cloud, index_t index, double radius, Indices &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. More... |
|
virtual int | radiusSearch (index_t index, double radius, Indices &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). More... |
|
virtual void | radiusSearch (const PointCloud &cloud, const Indices &indices, double radius, std::vector< Indices > &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. More... |
|
template<typename PointTDiff > | |
void | radiusSearchT (const pcl::PointCloud< PointTDiff > &cloud, const Indices &indices, double radius, std::vector< Indices > &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. More... |
|
Protected Member Functions |
|
bool | testPoint (const PointT &query, unsigned k, std::vector< Entry > &queue, index_t index) const |
test if point given by index is among the k NN in results to the query point. More... |
|
void | clipRange (int &begin, int &end, int min, int max) const |
void | getProjectedRadiusSearchBox (const PointT &point, float squared_radius, unsigned &minX, unsigned &minY, unsigned &maxX, unsigned &maxY) const |
Obtain a search box in 2D from a sphere with a radius in 3D. More... |
|
Protected Member Functions inherited from pcl::search::Search< PointT > | |
void | sortResults (Indices &indices, std::vector< float > &distances) const |
Protected Attributes |
|
Eigen::Matrix< float, 3, 4, Eigen::RowMajor > | projection_matrix_ |
the projection matrix. More... |
|
Eigen::Matrix< float, 3, 3, Eigen::RowMajor > | KR_ |
inveser of the left 3x3 projection matrix which is K * R (with K being the camera matrix and R the rotation matrix) More... |
|
Eigen::Matrix< float, 3, 3, Eigen::RowMajor > | KR_KRT_ |
inveser of the left 3x3 projection matrix which is K * R (with K being the camera matrix and R the rotation matrix) More... |
|
const float | eps_ |
epsilon value for the MSE of the projection matrix estimation More... |
|
const unsigned | pyramid_level_ |
using only a subsample of points to calculate the projection matrix. More... |
|
std::vector< unsigned char > | mask_ |
mask, indicating whether the point was in the indices list or not. More... |
|
Protected Attributes inherited from pcl::search::Search< PointT > | |
PointCloudConstPtr | input_ |
IndicesConstPtr | indices_ |
bool | sorted_results_ |
std::string | name_ |
Detailed Description
template<typename PointT>
class pcl::search::OrganizedNeighbor< PointT >
OrganizedNeighbor is a class for optimized nearest neigbhor search in organized point clouds.
Definition at line 60 of file organized.h.
Member Typedef Documentation
ConstPtr
using pcl::search::OrganizedNeighbor< PointT >::ConstPtr = shared_ptr<const pcl::search::OrganizedNeighbor<PointT> > |
Definition at line 71 of file organized.h.
PointCloud
using pcl::search::OrganizedNeighbor< PointT >::PointCloud = pcl::PointCloud<PointT> |
Definition at line 65 of file organized.h.
PointCloudConstPtr
using pcl::search::OrganizedNeighbor< PointT >::PointCloudConstPtr = typename PointCloud::ConstPtr |
Definition at line 68 of file organized.h.
PointCloudPtr
using pcl::search::OrganizedNeighbor< PointT >::PointCloudPtr = typename PointCloud::Ptr |
Definition at line 66 of file organized.h.
Ptr
using pcl::search::OrganizedNeighbor< PointT >::Ptr = shared_ptr<pcl::search::OrganizedNeighbor<PointT> > |
Definition at line 70 of file organized.h.
Constructor & Destructor Documentation
OrganizedNeighbor()
|
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 85 of file organized.h.
~OrganizedNeighbor()
|
inline |
Empty deconstructor.
Definition at line 96 of file organized.h.
Member Function Documentation
clipRange()
|
inlineprotected |
Definition at line 243 of file organized.h.
computeCameraMatrix()
void pcl::search::OrganizedNeighbor< PointT >::computeCameraMatrix | ( | Eigen::Matrix3f & | camera_matrix | ) | const |
Compute the camera matrix.
- Parameters
-
[out] camera_matrix the resultant computed camera matrix
Definition at line 326 of file organized.hpp.
References pcl::getCameraMatrixFromProjectionMatrix().
estimateProjectionMatrix()
void pcl::search::OrganizedNeighbor< PointT >::estimateProjectionMatrix |
estimated the projection matrix from the input cloud.
Definition at line 333 of file organized.hpp.
Referenced by pcl::search::OrganizedNeighbor< PointT >::setInputCloud().
getProjectedRadiusSearchBox()
|
protected |
Obtain a search box in 2D from a sphere with a radius in 3D.
- Parameters
-
[in] point the query point (sphere center) [in] squared_radius the squared sphere radius [out] minX the min X box coordinate [out] minY the min Y box coordinate [out] maxX the max X box coordinate [out] maxY the max Y box coordinate
Definition at line 269 of file organized.hpp.
isValid()
|
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 104 of file organized.h.
References pcl::search::Search< PointT >::input_, pcl::search::OrganizedNeighbor< PointT >::KR_, and pcl::search::OrganizedNeighbor< PointT >::KR_KRT_.
nearestKSearch()
|
overridevirtual |
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
- Todo:
- still need to implements this functionality
Implements pcl::search::Search< PointT >.
Definition at line 114 of file organized.hpp.
References pcl::isFinite().
projectPoint()
bool pcl::search::OrganizedNeighbor< PointT >::projectPoint | ( | const PointT & | p, |
pcl::PointXY & | q | ||
) | const |
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 378 of file organized.hpp.
References pcl::PointXY::x, and pcl::PointXY::y.
Referenced by pcl::visualization::ImageViewer::addMask(), pcl::visualization::ImageViewer::addPlanarPolygon(), and pcl::visualization::ImageViewer::addRectangle().
radiusSearch()
|
overridevirtual |
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 49 of file organized.hpp.
References pcl::isFinite().
setInputCloud()
|
inlineoverridevirtual |
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
Reimplemented from pcl::search::Search< PointT >.
Definition at line 125 of file organized.h.
References pcl::search::OrganizedNeighbor< PointT >::estimateProjectionMatrix(), pcl::search::Search< PointT >::indices_, pcl::search::Search< PointT >::input_, and pcl::search::OrganizedNeighbor< PointT >::mask_.
Referenced by pcl::visualization::ImageViewer::addMask(), pcl::visualization::ImageViewer::addPlanarPolygon(), and pcl::visualization::ImageViewer::addRectangle().
testPoint()
|
inlineprotected |
test if point given by index is among the k NN in results to the query point.
- Parameters
-
[in] query query point [in] k number of maximum nn interested in [in,out] queue priority queue with k NN [in] index index on point to be tested
- Returns
- whether the top element changed or not.
Definition at line 212 of file organized.h.
References pcl::search::Search< PointT >::input_, and pcl::search::OrganizedNeighbor< PointT >::mask_.
Member Data Documentation
eps_
|
protected |
epsilon value for the MSE of the projection matrix estimation
Definition at line 272 of file organized.h.
KR_
|
protected |
inveser of the left 3x3 projection matrix which is K * R (with K being the camera matrix and R the rotation matrix)
Definition at line 266 of file organized.h.
Referenced by pcl::search::OrganizedNeighbor< PointT >::isValid().
KR_KRT_
|
protected |
inveser of the left 3x3 projection matrix which is K * R (with K being the camera matrix and R the rotation matrix)
Definition at line 269 of file organized.h.
Referenced by pcl::search::OrganizedNeighbor< PointT >::isValid().
mask_
|
protected |
mask, indicating whether the point was in the indices list or not.
Definition at line 278 of file organized.h.
Referenced by pcl::search::OrganizedNeighbor< PointT >::setInputCloud(), and pcl::search::OrganizedNeighbor< PointT >::testPoint().
projection_matrix_
|
protected |
the projection matrix.
Either set by user or calculated by the first / each input cloud
Definition at line 263 of file organized.h.
pyramid_level_
|
protected |
using only a subsample of points to calculate the projection matrix.
pyramid_level_ = use down sampled cloud given by pyramid_level_
Definition at line 275 of file organized.h.
The documentation for this class was generated from the following files:
- pcl/search/organized.h
- pcl/search/impl/organized.hpp
© 2009–2012, Willow Garage, Inc.
© 2012–, Open Perception, Inc.
Licensed under the BSD License.
https://pointclouds.org/documentation/classpcl_1_1search_1_1_organized_neighbor.html