Point Cloud Library (PCL)
1.11.1-dev
|
41 #include <pcl/pcl_base.h>
42 #include <pcl/point_cloud.h>
43 #include <pcl/for_each_type.h>
44 #include <pcl/common/concatenate.h>
45 #include <pcl/common/copy_point.h>
73 template<
typename Po
intT>
81 using Ptr = shared_ptr<pcl::search::Search<PointT> >;
82 using ConstPtr = shared_ptr<const pcl::search::Search<PointT> >;
88 Search (
const std::string& name =
"",
bool sorted =
false);
98 virtual const std::string&
124 virtual PointCloudConstPtr
147 std::vector<float> &k_sqr_distances)
const = 0;
158 template <
typename Po
intTDiff>
inline int
160 Indices &k_indices, std::vector<float> &k_sqr_distances)
const
186 std::vector<float> &k_sqr_distances)
const;
208 std::vector<float> &k_sqr_distances)
const;
219 int k, std::vector<Indices>& k_indices,
220 std::vector< std::vector<float> >& k_sqr_distances)
const;
230 template <
typename Po
intTDiff>
void
232 std::vector< std::vector<float> > &k_sqr_distances)
const
235 using FieldListInT =
typename pcl::traits::fieldList<PointT>::type;
236 using FieldListOutT =
typename pcl::traits::fieldList<PointTDiff>::type;
240 if (indices.empty ())
243 for (std::size_t i = 0; i < cloud.
size(); i++)
252 pc.
resize (indices.size());
253 for (std::size_t i = 0; i < indices.size(); i++)
256 cloud[indices[i]], pc[i]));
274 std::vector<float>& k_sqr_distances,
unsigned int max_nn = 0)
const = 0;
286 template <
typename Po
intTDiff>
inline int
288 std::vector<float> &k_sqr_distances,
unsigned int max_nn = 0)
const
292 return (
radiusSearch (p, radius, k_indices, k_sqr_distances, max_nn));
314 Indices &k_indices, std::vector<float> &k_sqr_distances,
315 unsigned int max_nn = 0)
const;
338 std::vector<float> &k_sqr_distances,
unsigned int max_nn = 0)
const;
354 std::vector<Indices>& k_indices,
355 std::vector< std::vector<float> > &k_sqr_distances,
356 unsigned int max_nn = 0)
const;
369 template <
typename Po
intTDiff>
void
373 std::vector<Indices> &k_indices,
374 std::vector< std::vector<float> > &k_sqr_distances,
375 unsigned int max_nn = 0)
const
378 using FieldListInT =
typename pcl::traits::fieldList<PointT>::type;
379 using FieldListOutT =
typename pcl::traits::fieldList<PointTDiff>::type;
383 if (indices.empty ())
386 for (std::size_t i = 0; i < cloud.
size (); ++i)
392 pc.
resize (indices.size ());
393 for (std::size_t i = 0; i < indices.size (); ++i)
411 Compare (
const std::vector<float>& distances)
412 : distances_ (distances)
419 return (distances_ [first] < distances_[second]);
422 const std::vector<float>& distances_;
428 #ifdef PCL_NO_PRECOMPILE
429 #include <pcl/search/impl/search.hpp>
pcl::IndicesPtr IndicesPtr
shared_ptr< const pcl::search::Search< PointXYZRGB > > ConstPtr
shared_ptr< Indices > IndicesPtr
virtual void setSortedResults(bool sorted)
sets whether the results should be sorted (ascending in the distance) or not
virtual PointCloudConstPtr getInputCloud() const
Get a pointer to the input point cloud dataset.
pcl::IndicesConstPtr IndicesConstPtr
virtual const std::string & getName() const
Returns the search method name.
virtual int radiusSearch(const PointT &point, double radius, Indices &k_indices, std::vector< float > &k_sqr_distances, unsigned int max_nn=0) const =0
Search for all the nearest neighbors of the query point in a given radius.
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.
shared_ptr< const Indices > IndicesConstPtr
virtual bool getSortedResults()
Gets whether the results should be sorted (ascending in the distance) or not Otherwise the results ma...
virtual int nearestKSearch(const PointT &point, int k, Indices &k_indices, std::vector< float > &k_sqr_distances) const =0
Search for the k-nearest neighbors for the given query point.
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.
typename boost::mpl::remove_if< Sequence1, boost::mpl::not_< boost::mpl::contains< Sequence2, boost::mpl::_1 > > >::type type
Helper functor structure for concatenate.
PointCloud represents the base class in PCL for storing collections of 3D points.
detail::int_type_t< detail::index_type_size, detail::index_type_signed > index_t
Type used for an index in PCL.
A point structure representing Euclidean xyz coordinates, and the RGB color.
typename PointCloud::ConstPtr PointCloudConstPtr
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.
void copyPoint(const PointInT &point_in, PointOutT &point_out)
Copy the fields of a source point into a target point.
PointCloudConstPtr input_
virtual IndicesConstPtr getIndices() const
Get a pointer to the vector of indices used.
shared_ptr< pcl::search::Search< PointXYZRGB > > Ptr
void resize(std::size_t count)
Resizes the container to contain count elements.
Search(const std::string &name="", bool sorted=false)
Constructor.
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.
void sortResults(Indices &indices, std::vector< float > &distances) const
virtual ~Search()
Destructor.
IndicesAllocator<> Indices
Type used for indices in PCL.
shared_ptr< PointCloud< PointT > > Ptr
virtual void setInputCloud(const PointCloudConstPtr &cloud, const IndicesConstPtr &indices=IndicesConstPtr())
Pass the input dataset that the search will be performed on.
shared_ptr< const PointCloud< PointT > > ConstPtr
typename PointCloud::Ptr PointCloudPtr