voxel_grid_covariance.h
/*
* Software License Agreement (BSD License)
*
* Point Cloud Library (PCL) - www.pointclouds.org
* Copyright (c) 2010-2011, Willow Garage, Inc.
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of the copyright holder(s) nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
#pragma once
#include <pcl/filters/boost.h>
#include <pcl/filters/voxel_grid.h>
#include <map>
#include <pcl/point_types.h>
#include <pcl/kdtree/kdtree_flann.h>
namespace pcl
{
/** \brief A searchable voxel strucure containing the mean and covariance of the data.
* \note For more information please see
* <b>Magnusson, M. (2009). The Three-Dimensional Normal-Distributions Transform —
* an Efﬁcient Representation for Registration, Surface Analysis, and Loop Detection.
* PhD thesis, Orebro University. Orebro Studies in Technology 36</b>
* \author Brian Okorn (Space and Naval Warfare Systems Center Pacific)
*/
template<typename PointT>
class VoxelGridCovariance : public VoxelGrid<PointT>
{
protected:
using VoxelGrid<PointT>::filter_name_;
using VoxelGrid<PointT>::getClassName;
using VoxelGrid<PointT>::input_;
using VoxelGrid<PointT>::indices_;
using VoxelGrid<PointT>::filter_limit_negative_;
using VoxelGrid<PointT>::filter_limit_min_;
using VoxelGrid<PointT>::filter_limit_max_;
using VoxelGrid<PointT>::filter_field_name_;
using VoxelGrid<PointT>::downsample_all_data_;
using VoxelGrid<PointT>::leaf_layout_;
using VoxelGrid<PointT>::save_leaf_layout_;
using VoxelGrid<PointT>::leaf_size_;
using VoxelGrid<PointT>::min_b_;
using VoxelGrid<PointT>::max_b_;
using VoxelGrid<PointT>::inverse_leaf_size_;
using VoxelGrid<PointT>::div_b_;
using VoxelGrid<PointT>::divb_mul_;
using FieldList = typename pcl::traits::fieldList<PointT>::type;
using PointCloud = typename Filter<PointT>::PointCloud;
using PointCloudPtr = typename PointCloud::Ptr;
using PointCloudConstPtr = typename PointCloud::ConstPtr;
public:
using Ptr = shared_ptr<VoxelGrid<PointT> >;
using ConstPtr = shared_ptr<const VoxelGrid<PointT> >;
/** \brief Simple structure to hold a centroid, covarince and the number of points in a leaf.
* Inverse covariance, eigen vectors and engen values are precomputed. */
struct Leaf
{
/** \brief Constructor.
* Sets \ref nr_points, \ref icov_, \ref mean_ and \ref evals_ to 0 and \ref cov_ and \ref evecs_ to the identity matrix
*/
Leaf () :
nr_points (0),
mean_ (Eigen::Vector3d::Zero ()),
cov_ (Eigen::Matrix3d::Identity ()),
icov_ (Eigen::Matrix3d::Zero ()),
evecs_ (Eigen::Matrix3d::Identity ()),
evals_ (Eigen::Vector3d::Zero ())
{
}
/** \brief Get the voxel covariance.
* \return covariance matrix
*/
Eigen::Matrix3d
getCov () const
{
return (cov_);
}
/** \brief Get the inverse of the voxel covariance.
* \return inverse covariance matrix
*/
Eigen::Matrix3d
getInverseCov () const
{
return (icov_);
}
/** \brief Get the voxel centroid.
* \return centroid
*/
Eigen::Vector3d
getMean () const
{
return (mean_);
}
/** \brief Get the eigen vectors of the voxel covariance.
* \note Order corresponds with \ref getEvals
* \return matrix whose columns contain eigen vectors
*/
Eigen::Matrix3d
getEvecs () const
{
return (evecs_);
}
/** \brief Get the eigen values of the voxel covariance.
* \note Order corresponds with \ref getEvecs
* \return vector of eigen values
*/
Eigen::Vector3d
getEvals () const
{
return (evals_);
}
/** \brief Get the number of points contained by this voxel.
* \return number of points
*/
int
getPointCount () const
{
return (nr_points);
}
/** \brief Number of points contained by voxel */
int nr_points;
/** \brief 3D voxel centroid */
Eigen::Vector3d mean_;
/** \brief Nd voxel centroid
* \note Differs from \ref mean_ when color data is used
*/
Eigen::VectorXf centroid;
/** \brief Voxel covariance matrix */
Eigen::Matrix3d cov_;
/** \brief Inverse of voxel covariance matrix */
Eigen::Matrix3d icov_;
/** \brief Eigen vectors of voxel covariance matrix */
Eigen::Matrix3d evecs_;
/** \brief Eigen values of voxel covariance matrix */
Eigen::Vector3d evals_;
};
/** \brief Pointer to VoxelGridCovariance leaf structure */
using LeafPtr = Leaf *;
/** \brief Const pointer to VoxelGridCovariance leaf structure */
using LeafConstPtr = const Leaf *;
public:
/** \brief Constructor.
* Sets \ref leaf_size_ to 0 and \ref searchable_ to false.
*/
VoxelGridCovariance () :
searchable_ (true),
min_points_per_voxel_ (6),
min_covar_eigvalue_mult_ (0.01),
leaves_ (),
voxel_centroids_ (),
kdtree_ ()
{
downsample_all_data_ = false;
save_leaf_layout_ = false;
leaf_size_.setZero ();
min_b_.setZero ();
max_b_.setZero ();
filter_name_ = "VoxelGridCovariance";
}
/** \brief Set the minimum number of points required for a cell to be used (must be 3 or greater for covariance calculation).
* \param[in] min_points_per_voxel the minimum number of points for required for a voxel to be used
*/
inline void
setMinPointPerVoxel (int min_points_per_voxel)
{
if(min_points_per_voxel > 2)
{
min_points_per_voxel_ = min_points_per_voxel;
}
else
{
PCL_WARN ("%s: Covariance calculation requires at least 3 points, setting Min Point per Voxel to 3 ", this->getClassName ().c_str ());
min_points_per_voxel_ = 3;
}
}
/** \brief Get the minimum number of points required for a cell to be used.
* \return the minimum number of points for required for a voxel to be used
*/
inline int
getMinPointPerVoxel ()
{
return min_points_per_voxel_;
}
/** \brief Set the minimum allowable ratio between eigenvalues to prevent singular covariance matrices.
* \param[in] min_covar_eigvalue_mult the minimum allowable ratio between eigenvalues
*/
inline void
setCovEigValueInflationRatio (double min_covar_eigvalue_mult)
{
min_covar_eigvalue_mult_ = min_covar_eigvalue_mult;
}
/** \brief Get the minimum allowable ratio between eigenvalues to prevent singular covariance matrices.
* \return the minimum allowable ratio between eigenvalues
*/
inline double
getCovEigValueInflationRatio ()
{
return min_covar_eigvalue_mult_;
}
/** \brief Filter cloud and initializes voxel structure.
* \param[out] output cloud containing centroids of voxels containing a sufficient number of points
* \param[in] searchable flag if voxel structure is searchable, if true then kdtree is built
*/
inline void
filter (PointCloud &output, bool searchable = false)
{
searchable_ = searchable;
applyFilter (output);
voxel_centroids_ = PointCloudPtr (new PointCloud (output));
if (searchable_ && !voxel_centroids_->empty ())
{
// Initiates kdtree of the centroids of voxels containing a sufficient number of points
kdtree_.setInputCloud (voxel_centroids_);
}
}
/** \brief Initializes voxel structure.
* \param[in] searchable flag if voxel structure is searchable, if true then kdtree is built
*/
inline void
filter (bool searchable = false)
{
searchable_ = searchable;
voxel_centroids_ = PointCloudPtr (new PointCloud);
applyFilter (*voxel_centroids_);
if (searchable_ && !voxel_centroids_->empty ())
{
// Initiates kdtree of the centroids of voxels containing a sufficient number of points
kdtree_.setInputCloud (voxel_centroids_);
}
}
/** \brief Get the voxel containing point p.
* \param[in] index the index of the leaf structure node
* \return const pointer to leaf structure
*/
inline LeafConstPtr
getLeaf (int index)
{
typename std::map<std::size_t, Leaf>::iterator leaf_iter = leaves_.find (index);
if (leaf_iter != leaves_.end ())
{
LeafConstPtr ret (&(leaf_iter->second));
return ret;
}
return nullptr;
}
/** \brief Get the voxel containing point p.
* \param[in] p the point to get the leaf structure at
* \return const pointer to leaf structure
*/
inline LeafConstPtr
getLeaf (PointT &p)
{
// Generate index associated with p
int ijk0 = static_cast<int> (std::floor (p.x * inverse_leaf_size_[0]) - min_b_[0]);
int ijk1 = static_cast<int> (std::floor (p.y * inverse_leaf_size_[1]) - min_b_[1]);
int ijk2 = static_cast<int> (std::floor (p.z * inverse_leaf_size_[2]) - min_b_[2]);
// Compute the centroid leaf index
int idx = ijk0 * divb_mul_[0] + ijk1 * divb_mul_[1] + ijk2 * divb_mul_[2];
// Find leaf associated with index
typename std::map<std::size_t, Leaf>::iterator leaf_iter = leaves_.find (idx);
if (leaf_iter != leaves_.end ())
{
// If such a leaf exists return the pointer to the leaf structure
LeafConstPtr ret (&(leaf_iter->second));
return ret;
}
return nullptr;
}
/** \brief Get the voxel containing point p.
* \param[in] p the point to get the leaf structure at
* \return const pointer to leaf structure
*/
inline LeafConstPtr
getLeaf (Eigen::Vector3f &p)
{
// Generate index associated with p
int ijk0 = static_cast<int> (std::floor (p[0] * inverse_leaf_size_[0]) - min_b_[0]);
int ijk1 = static_cast<int> (std::floor (p[1] * inverse_leaf_size_[1]) - min_b_[1]);
int ijk2 = static_cast<int> (std::floor (p[2] * inverse_leaf_size_[2]) - min_b_[2]);
// Compute the centroid leaf index
int idx = ijk0 * divb_mul_[0] + ijk1 * divb_mul_[1] + ijk2 * divb_mul_[2];
// Find leaf associated with index
typename std::map<std::size_t, Leaf>::iterator leaf_iter = leaves_.find (idx);
if (leaf_iter != leaves_.end ())
{
// If such a leaf exists return the pointer to the leaf structure
LeafConstPtr ret (&(leaf_iter->second));
return ret;
}
return nullptr;
}
/** \brief Get the voxels surrounding point p, not including the voxel containing point p.
* \note Only voxels containing a sufficient number of points are used (slower than radius search in practice).
* \param[in] reference_point the point to get the leaf structure at
* \param[out] neighbors
* \return number of neighbors found
*/
int
getNeighborhoodAtPoint (const PointT& reference_point, std::vector<LeafConstPtr> &neighbors);
/** \brief Get the leaf structure map
* \return a map contataining all leaves
*/
inline const std::map<std::size_t, Leaf>&
getLeaves ()
{
return leaves_;
}
/** \brief Get a pointcloud containing the voxel centroids
* \note Only voxels containing a sufficient number of points are used.
* \return a map contataining all leaves
*/
inline PointCloudPtr
getCentroids ()
{
return voxel_centroids_;
}
/** \brief Get a cloud to visualize each voxels normal distribution.
* \param[out] cell_cloud a cloud created by sampling the normal distributions of each voxel
*/
void
getDisplayCloud (pcl::PointCloud<PointXYZ>& cell_cloud);
/** \brief Search for the k-nearest occupied voxels for the given query point.
* \note Only voxels containing a sufficient number of points are used.
* \param[in] point the given query point
* \param[in] k the number of neighbors to search for
* \param[out] k_leaves the resultant leaves of the neighboring points
* \param[out] k_sqr_distances the resultant squared distances to the neighboring points
* \return number of neighbors found
*/
int
nearestKSearch (const PointT &point, int k,
std::vector<LeafConstPtr> &k_leaves, std::vector<float> &k_sqr_distances)
{
k_leaves.clear ();
// Check if kdtree has been built
if (!searchable_)
{
PCL_WARN ("%s: Not Searchable", this->getClassName ().c_str ());
return 0;
}
// Find k-nearest neighbors in the occupied voxel centroid cloud
std::vector<int> k_indices;
k = kdtree_.nearestKSearch (point, k, k_indices, k_sqr_distances);
// Find leaves corresponding to neighbors
k_leaves.reserve (k);
for (const int &k_index : k_indices)
{
k_leaves.push_back (&leaves_[voxel_centroids_leaf_indices_[k_index]]);
}
return k;
}
/** \brief Search for the k-nearest occupied voxels for the given query point.
* \note Only voxels containing a sufficient number of points are used.
* \param[in] cloud the given query point
* \param[in] index the index
* \param[in] k the number of neighbors to search for
* \param[out] k_leaves the resultant leaves of the neighboring points
* \param[out] k_sqr_distances the resultant squared distances to the neighboring points
* \return number of neighbors found
*/
inline int
nearestKSearch (const PointCloud &cloud, int index, int k,
std::vector<LeafConstPtr> &k_leaves, std::vector<float> &k_sqr_distances)
{
if (index >= static_cast<int> (cloud.points.size ()) || index < 0)
return (0);
return (nearestKSearch (cloud.points[index], k, k_leaves, k_sqr_distances));
}
/** \brief Search for all the nearest occupied voxels of the query point in a given radius.
* \note Only voxels containing a sufficient number of points are used.
* \param[in] point the given query point
* \param[in] radius the radius of the sphere bounding all of p_q's neighbors
* \param[out] k_leaves the resultant leaves of the neighboring points
* \param[out] k_sqr_distances the resultant squared distances to the neighboring points
* \param[in] max_nn
* \return number of neighbors found
*/
int
radiusSearch (const PointT &point, double radius, std::vector<LeafConstPtr> &k_leaves,
std::vector<float> &k_sqr_distances, unsigned int max_nn = 0)
{
k_leaves.clear ();
// Check if kdtree has been built
if (!searchable_)
{
PCL_WARN ("%s: Not Searchable", this->getClassName ().c_str ());
return 0;
}
// Find neighbors within radius in the occupied voxel centroid cloud
std::vector<int> k_indices;
int k = kdtree_.radiusSearch (point, radius, k_indices, k_sqr_distances, max_nn);
// Find leaves corresponding to neighbors
k_leaves.reserve (k);
for (const int &k_index : k_indices)
{
k_leaves.push_back (&leaves_[voxel_centroids_leaf_indices_[k_index]]);
}
return k;
}
/** \brief Search for all the nearest occupied voxels of the query point in a given radius.
* \note Only voxels containing a sufficient number of points are used.
* \param[in] cloud the given query point
* \param[in] index a valid index in cloud representing a valid (i.e., finite) query point
* \param[in] radius the radius of the sphere bounding all of p_q's neighbors
* \param[out] k_leaves the resultant leaves of the neighboring points
* \param[out] k_sqr_distances the resultant squared distances to the neighboring points
* \param[in] max_nn
* \return number of neighbors found
*/
inline int
radiusSearch (const PointCloud &cloud, int index, double radius,
std::vector<LeafConstPtr> &k_leaves, std::vector<float> &k_sqr_distances,
unsigned int max_nn = 0)
{
if (index >= static_cast<int> (cloud.points.size ()) || index < 0)
return (0);
return (radiusSearch (cloud.points[index], radius, k_leaves, k_sqr_distances, max_nn));
}
protected:
/** \brief Filter cloud and initializes voxel structure.
* \param[out] output cloud containing centroids of voxels containing a sufficient number of points
*/
void applyFilter (PointCloud &output) override;
/** \brief Flag to determine if voxel structure is searchable. */
bool searchable_;
/** \brief Minimum points contained with in a voxel to allow it to be usable. */
int min_points_per_voxel_;
/** \brief Minimum allowable ratio between eigenvalues to prevent singular covariance matrices. */
double min_covar_eigvalue_mult_;
/** \brief Voxel structure containing all leaf nodes (includes voxels with less than a sufficient number of points). */
std::map<std::size_t, Leaf> leaves_;
/** \brief Point cloud containing centroids of voxels containing atleast minimum number of points. */
PointCloudPtr voxel_centroids_;
/** \brief Indices of leaf structurs associated with each point in \ref voxel_centroids_ (used for searching). */
std::vector<int> voxel_centroids_leaf_indices_;
/** \brief KdTree generated using \ref voxel_centroids_ (used for searching). */
KdTreeFLANN<PointT> kdtree_;
};
}
#ifdef PCL_NO_PRECOMPILE
#include <pcl/filters/impl/voxel_grid_covariance.hpp>
#endif
pcl::VoxelGrid
VoxelGrid assembles a local 3D grid over a given PointCloud, and downsamples + filters the data.
Definition: voxel_grid.h:177
pcl
This file defines compatibility wrappers for low level I/O functions.
Definition: convolution.h:45
pcl::VoxelGridCovariance::VoxelGridCovariance
VoxelGridCovariance()
Constructor.
Definition: voxel_grid_covariance.h:199
point_types.h
pcl::Filter< PointTarget >::Ptr
shared_ptr< Filter< PointTarget > > Ptr
Definition: filter.h:89
Eigen
Definition: bfgs.h:9
pcl::PCLBase< PointTarget >::PointCloudConstPtr
typename PointCloud::ConstPtr PointCloudConstPtr
Definition: pcl_base.h:74
pcl::PointCloud::points
std::vector< PointT, Eigen::aligned_allocator< PointT > > points
The point data.
Definition: point_cloud.h:397
pcl::PCLBase< PointTarget >::PointCloudPtr
typename PointCloud::Ptr PointCloudPtr
Definition: pcl_base.h:73
pcl::VoxelGridCovariance::applyFilter
void applyFilter(PointCloud &output) override
Filter cloud and initializes voxel structure.
Definition: voxel_grid_covariance.hpp:49
pcl::VoxelGridCovariance< PointTarget >::LeafConstPtr
const Leaf * LeafConstPtr
Const pointer to VoxelGridCovariance leaf structure.
Definition: voxel_grid_covariance.h:192
pcl::VoxelGridCovariance::getCovEigValueInflationRatio
double getCovEigValueInflationRatio()
Get the minimum allowable ratio between eigenvalues to prevent singular covariance matrices.
Definition: voxel_grid_covariance.h:254
pcl::VoxelGridCovariance::Leaf::icov_
Eigen::Matrix3d icov_
Inverse of voxel covariance matrix.
Definition: voxel_grid_covariance.h:178
pcl::VoxelGrid::downsample_all_data_
bool downsample_all_data_
Set to true if all fields need to be downsampled, or false if just XYZ.
Definition: voxel_grid.h:462
pcl::VoxelGridCovariance::PointCloudPtr
typename PointCloud::Ptr PointCloudPtr
Definition: voxel_grid_covariance.h:81
pcl::PointCloud< PointTarget >
pcl::VoxelGrid::inverse_leaf_size_
Eigen::Array4f inverse_leaf_size_
Internal leaf sizes stored as 1/leaf_size_ for efficiency reasons.
Definition: voxel_grid.h:459
pcl::VoxelGrid< PointTarget >::FieldList
typename pcl::traits::fieldList< PointTarget >::type FieldList
Definition: voxel_grid.h:488
pcl::VoxelGridCovariance::getNeighborhoodAtPoint
int getNeighborhoodAtPoint(const PointT &reference_point, std::vector< LeafConstPtr > &neighbors)
Get the voxels surrounding point p, not including the voxel containing point p.
Definition: voxel_grid_covariance.hpp:374
pcl::PointXYZRGB
A point structure representing Euclidean xyz coordinates, and the RGB color.
Definition: point_types.hpp:623
pcl::VoxelGridCovariance::getLeaf
LeafConstPtr getLeaf(PointT &p)
Get the voxel containing point p.
Definition: voxel_grid_covariance.h:316
pcl::VoxelGridCovariance::getLeaf
LeafConstPtr getLeaf(int index)
Get the voxel containing point p.
Definition: voxel_grid_covariance.h:300
pcl::VoxelGrid::save_leaf_layout_
bool save_leaf_layout_
Set to true if leaf layout information needs to be saved in leaf_layout_.
Definition: voxel_grid.h:465
pcl::VoxelGridCovariance::voxel_centroids_
PointCloudPtr voxel_centroids_
Point cloud containing centroids of voxels containing atleast minimum number of points.
Definition: voxel_grid_covariance.h:527
pcl::VoxelGridCovariance::Leaf::getMean
Eigen::Vector3d getMean() const
Get the voxel centroid.
Definition: voxel_grid_covariance.h:129
pcl::VoxelGridCovariance::filter
void filter(bool searchable=false)
Initializes voxel structure.
Definition: voxel_grid_covariance.h:282
pcl::VoxelGridCovariance::voxel_centroids_leaf_indices_
std::vector< int > voxel_centroids_leaf_indices_
Indices of leaf structurs associated with each point in voxel_centroids_ (used for searching).
Definition: voxel_grid_covariance.h:530
pcl::VoxelGridCovariance::kdtree_
KdTreeFLANN< PointT > kdtree_
KdTree generated using voxel_centroids_ (used for searching).
Definition: voxel_grid_covariance.h:533
pcl::VoxelGridCovariance::Leaf::centroid
Eigen::VectorXf centroid
Nd voxel centroid.
Definition: voxel_grid_covariance.h:172
pcl::VoxelGridCovariance::radiusSearch
int radiusSearch(const PointCloud &cloud, int index, double radius, std::vector< LeafConstPtr > &k_leaves, std::vector< float > &k_sqr_distances, unsigned int max_nn=0)
Search for all the nearest occupied voxels of the query point in a given radius.
Definition: voxel_grid_covariance.h:498
pcl::VoxelGridCovariance::getCentroids
PointCloudPtr getCentroids()
Get a pointcloud containing the voxel centroids.
Definition: voxel_grid_covariance.h:387
pcl::VoxelGridCovariance::getDisplayCloud
void getDisplayCloud(pcl::PointCloud< PointXYZ > &cell_cloud)
Get a cloud to visualize each voxels normal distribution.
Definition: voxel_grid_covariance.hpp:409
pcl::VoxelGridCovariance< PointTarget >::LeafPtr
Leaf * LeafPtr
Pointer to VoxelGridCovariance leaf structure.
Definition: voxel_grid_covariance.h:189
pcl::VoxelGridCovariance::getLeaves
const std::map< std::size_t, Leaf > & getLeaves()
Get the leaf structure map.
Definition: voxel_grid_covariance.h:377
pcl::VoxelGridCovariance::Leaf::getEvecs
Eigen::Matrix3d getEvecs() const
Get the eigen vectors of the voxel covariance.
Definition: voxel_grid_covariance.h:139
pcl::KdTreeFLANN< PointT >
pcl::VoxelGridCovariance
A searchable voxel strucure containing the mean and covariance of the data.
Definition: voxel_grid_covariance.h:56
pcl::VoxelGridCovariance::Leaf::evals_
Eigen::Vector3d evals_
Eigen values of voxel covariance matrix.
Definition: voxel_grid_covariance.h:184
pcl::VoxelGrid::min_b_
Eigen::Vector4i min_b_
The minimum and maximum bin coordinates, the number of divisions, and the division multiplier.
Definition: voxel_grid.h:471
pcl::VoxelGridCovariance::Leaf::getEvals
Eigen::Vector3d getEvals() const
Get the eigen values of the voxel covariance.
Definition: voxel_grid_covariance.h:149
pcl::VoxelGridCovariance::Leaf::evecs_
Eigen::Matrix3d evecs_
Eigen vectors of voxel covariance matrix.
Definition: voxel_grid_covariance.h:181
pcl::VoxelGridCovariance::Leaf::mean_
Eigen::Vector3d mean_
3D voxel centroid
Definition: voxel_grid_covariance.h:167
pcl::VoxelGridCovariance::searchable_
bool searchable_
Flag to determine if voxel structure is searchable.
Definition: voxel_grid_covariance.h:515
pcl::VoxelGridCovariance::Leaf::getCov
Eigen::Matrix3d getCov() const
Get the voxel covariance.
Definition: voxel_grid_covariance.h:111
pcl::Filter< PointTarget >::ConstPtr
shared_ptr< const Filter< PointTarget > > ConstPtr
Definition: filter.h:90
pcl::KdTreeFLANN::radiusSearch
int radiusSearch(const PointT &point, double radius, std::vector< int > &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.
Definition: kdtree_flann.hpp:171
pcl::VoxelGridCovariance::Leaf::Leaf
Leaf()
Constructor.
Definition: voxel_grid_covariance.h:97
pcl::VoxelGridCovariance::min_covar_eigvalue_mult_
double min_covar_eigvalue_mult_
Minimum allowable ratio between eigenvalues to prevent singular covariance matrices.
Definition: voxel_grid_covariance.h:521
pcl::VoxelGridCovariance::getLeaf
LeafConstPtr getLeaf(Eigen::Vector3f &p)
Get the voxel containing point p.
Definition: voxel_grid_covariance.h:342
pcl::VoxelGridCovariance::radiusSearch
int radiusSearch(const PointT &point, double radius, std::vector< LeafConstPtr > &k_leaves, std::vector< float > &k_sqr_distances, unsigned int max_nn=0)
Search for all the nearest occupied voxels of the query point in a given radius.
Definition: voxel_grid_covariance.h:462
pcl::VoxelGrid::divb_mul_
Eigen::Vector4i divb_mul_
Definition: voxel_grid.h:471
pcl::VoxelGridCovariance::leaves_
std::map< std::size_t, Leaf > leaves_
Voxel structure containing all leaf nodes (includes voxels with less than a sufficient number of poin...
Definition: voxel_grid_covariance.h:524
pcl::VoxelGridCovariance::setMinPointPerVoxel
void setMinPointPerVoxel(int min_points_per_voxel)
Set the minimum number of points required for a cell to be used (must be 3 or greater for covariance ...
Definition: voxel_grid_covariance.h:219
pcl::VoxelGridCovariance::getMinPointPerVoxel
int getMinPointPerVoxel()
Get the minimum number of points required for a cell to be used.
Definition: voxel_grid_covariance.h:236
pcl::VoxelGridCovariance::filter
void filter(PointCloud &output, bool searchable=false)
Filter cloud and initializes voxel structure.
Definition: voxel_grid_covariance.h:264
pcl::Filter::filter_name_
std::string filter_name_
The filter name.
Definition: filter.h:164
pcl::PointCloud::Ptr
shared_ptr< PointCloud< PointT > > Ptr
Definition: point_cloud.h:415
pcl::VoxelGridCovariance::Leaf::getInverseCov
Eigen::Matrix3d getInverseCov() const
Get the inverse of the voxel covariance.
Definition: voxel_grid_covariance.h:120
pcl::VoxelGridCovariance::Leaf::getPointCount
int getPointCount() const
Get the number of points contained by this voxel.
Definition: voxel_grid_covariance.h:158
pcl::VoxelGridCovariance::Leaf::cov_
Eigen::Matrix3d cov_
Voxel covariance matrix.
Definition: voxel_grid_covariance.h:175
pcl::Filter::getClassName
const std::string & getClassName() const
Get a string representation of the name of this class.
Definition: filter.h:180
pcl::VoxelGridCovariance::Leaf::nr_points
int nr_points
Number of points contained by voxel.
Definition: voxel_grid_covariance.h:164
pcl::VoxelGrid::leaf_size_
Eigen::Vector4f leaf_size_
The size of a leaf.
Definition: voxel_grid.h:456
pcl::VoxelGridCovariance::Leaf
Simple structure to hold a centroid, covarince and the number of points in a leaf.
Definition: voxel_grid_covariance.h:92
pcl::PointCloud::ConstPtr
shared_ptr< const PointCloud< PointT > > ConstPtr
Definition: point_cloud.h:416
pcl::VoxelGrid::max_b_
Eigen::Vector4i max_b_
Definition: voxel_grid.h:471
pcl::VoxelGridCovariance::min_points_per_voxel_
int min_points_per_voxel_
Minimum points contained with in a voxel to allow it to be usable.
Definition: voxel_grid_covariance.h:518
pcl::VoxelGridCovariance::setCovEigValueInflationRatio
void setCovEigValueInflationRatio(double min_covar_eigvalue_mult)
Set the minimum allowable ratio between eigenvalues to prevent singular covariance matrices.
Definition: voxel_grid_covariance.h:245
pcl::VoxelGridCovariance::nearestKSearch
int nearestKSearch(const PointT &point, int k, std::vector< LeafConstPtr > &k_leaves, std::vector< float > &k_sqr_distances)
Search for the k-nearest occupied voxels for the given query point.
Definition: voxel_grid_covariance.h:408
pcl::KdTreeFLANN::setInputCloud
void setInputCloud(const PointCloudConstPtr &cloud, const IndicesConstPtr &indices=IndicesConstPtr()) override
Provide a pointer to the input dataset.
Definition: kdtree_flann.hpp:94
pcl::KdTreeFLANN::nearestKSearch
int nearestKSearch(const PointT &point, int k, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances) const override
Search for k-nearest neighbors for the given query point.
Definition: kdtree_flann.hpp:134
pcl::shared_ptr
boost::shared_ptr< T > shared_ptr
Alias for boost::shared_ptr.
Definition: pcl_macros.h:90
pcl::traits::fieldList
Definition: point_traits.h:179
pcl::VoxelGridCovariance::nearestKSearch
int nearestKSearch(const PointCloud &cloud, int index, int k, std::vector< LeafConstPtr > &k_leaves, std::vector< float > &k_sqr_distances)
Search for the k-nearest occupied voxels for the given query point.
Definition: voxel_grid_covariance.h:443