VoxelGrid assembles a local 3D grid over a given PointCloud, and downsamples + filters the data. More...
#include <voxel_grid.h>
Classes | |
struct | Leaf |
Simple structure to hold an nD centroid and the number of points in a leaf. More... | |
Public Member Functions | |
int | getCentroidIndex (float x, float y, float z) |
Returns the index in the resulting downsampled cloud of the specified point. | |
int | getCentroidIndexAt (Eigen::Vector3i ijk, bool verbose=true) |
Returns the index in the downsampled cloud corresponding to coordinates (i,j,k) in the grid (-1 if empty). | |
Eigen::Vector3i | getDivisionMultiplier () |
Get the multipliers to be applied to the grid coordinates in order to find the centroid index (after filtering is performed). | |
bool | getDownsampleAllData () |
Get the state of the internal downsampling parameter (true if all fields need to be downsampled, false if just XYZ). | |
Eigen::Vector3i | getGridCoordinates (float x, float y, float z) |
Returns the corresponding (i,j,k) coordinates in the grid of point (x,y,z). | |
std::vector< int > | getLeafLayout () |
Returns the layout of the leafs for fast access to cells relative to current position. | |
Eigen::Vector3f | getLeafSize () |
Get the voxel grid leaf size. | |
Eigen::Vector3i | getMaxBoxCoordinates () |
Get the minimum coordinates of the bounding box (after filtering is performed). | |
Eigen::Vector3i | getMinBoxCoordinates () |
Get the minimum coordinates of the bounding box (after filtering is performed). | |
std::vector< int > | getNeighborCentroidIndices (float x, float y, float z, std::vector< Eigen::Vector3i > relative_coordinates) |
std::vector< int > | getNeighborCentroidIndices (float x, float y, float z, Eigen::MatrixXi relative_coordinates) |
Returns the indices in the resulting downsampled cloud of the points at the specified grid coordinates, relative to the grid coordinates of the specified point (or -1 if the cell was empty/out of bounds). | |
Eigen::Vector3i | getNrDivisions () |
Get the number of divisions along all 3 axes (after filtering is performed). | |
bool | getSaveLeafLayout () |
Returns true if leaf layout information will to be saved for later access. | |
void | setDownsampleAllData (bool downsample) |
Set to true if all fields need to be downsampled, or false if just XYZ. | |
void | setLeafSize (float lx, float ly, float lz) |
Set the voxel grid leaf size. | |
void | setLeafSize (const Eigen::Vector4f &leaf_size) |
Set the voxel grid leaf size. | |
void | setSaveLeafLayout (bool save_leaf_layout) |
Set to true if leaf layout information needs to be saved for later access. | |
VoxelGrid () | |
Empty constructor. | |
Protected Member Functions | |
void | applyFilter (PointCloud2 &output) |
Downsample a Point Cloud using a voxelized grid approach. | |
Protected Attributes | |
Eigen::Vector4i | div_b_ |
Eigen::Vector4i | divb_mul_ |
bool | downsample_all_data_ |
Set to true if all fields need to be downsampled, or false if just XYZ. | |
std::vector< int > | leaf_layout_ |
The leaf layout information for fast access to cells relative to current position. | |
Eigen::Vector4f | leaf_size_ |
The size of a leaf. | |
std::map< size_t, Leaf > | leaves_ |
The 3D grid leaves. | |
Eigen::Vector4i | max_b_ |
Eigen::Vector4i | min_b_ |
The minimum and maximum bin coordinates, the number of divisions, and the division multiplier. | |
bool | save_leaf_layout_ |
Set to true if leaf layout information needs to be saved in leaf_layout_. | |
Private Types | |
typedef sensor_msgs::PointCloud2 | PointCloud2 |
typedef PointCloud2::ConstPtr | PointCloud2ConstPtr |
typedef PointCloud2::Ptr | PointCloud2Ptr |
VoxelGrid assembles a local 3D grid over a given PointCloud, and downsamples + filters the data.
Definition at line 310 of file voxel_grid.h.
typedef sensor_msgs::PointCloud2 pcl::VoxelGrid< sensor_msgs::PointCloud2 >::PointCloud2 [private] |
Reimplemented from pcl::Filter< sensor_msgs::PointCloud2 >.
Definition at line 315 of file voxel_grid.h.
typedef PointCloud2::ConstPtr pcl::VoxelGrid< sensor_msgs::PointCloud2 >::PointCloud2ConstPtr [private] |
Reimplemented from pcl::Filter< sensor_msgs::PointCloud2 >.
Definition at line 317 of file voxel_grid.h.
typedef PointCloud2::Ptr pcl::VoxelGrid< sensor_msgs::PointCloud2 >::PointCloud2Ptr [private] |
Reimplemented from pcl::Filter< sensor_msgs::PointCloud2 >.
Definition at line 316 of file voxel_grid.h.
pcl::VoxelGrid< sensor_msgs::PointCloud2 >::VoxelGrid | ( | ) | [inline] |
Empty constructor.
Definition at line 321 of file voxel_grid.h.
void pcl::VoxelGrid< sensor_msgs::PointCloud2 >::applyFilter | ( | PointCloud2 & | output | ) | [protected, virtual] |
Downsample a Point Cloud using a voxelized grid approach.
output | the resultant point cloud |
Implements pcl::Filter< sensor_msgs::PointCloud2 >.
Definition at line 174 of file voxel_grid.cpp.
int pcl::VoxelGrid< sensor_msgs::PointCloud2 >::getCentroidIndex | ( | float | x, | |
float | y, | |||
float | z | |||
) | [inline] |
Returns the index in the resulting downsampled cloud of the specified point.
Definition at line 392 of file voxel_grid.h.
int pcl::VoxelGrid< sensor_msgs::PointCloud2 >::getCentroidIndexAt | ( | Eigen::Vector3i | ijk, | |
bool | verbose = true | |||
) | [inline] |
Returns the index in the downsampled cloud corresponding to coordinates (i,j,k) in the grid (-1 if empty).
Definition at line 450 of file voxel_grid.h.
Eigen::Vector3i pcl::VoxelGrid< sensor_msgs::PointCloud2 >::getDivisionMultiplier | ( | ) | [inline] |
Get the multipliers to be applied to the grid coordinates in order to find the centroid index (after filtering is performed).
Definition at line 385 of file voxel_grid.h.
bool pcl::VoxelGrid< sensor_msgs::PointCloud2 >::getDownsampleAllData | ( | ) | [inline] |
Get the state of the internal downsampling parameter (true if all fields need to be downsampled, false if just XYZ).
Definition at line 359 of file voxel_grid.h.
Eigen::Vector3i pcl::VoxelGrid< sensor_msgs::PointCloud2 >::getGridCoordinates | ( | float | x, | |
float | y, | |||
float | z | |||
) | [inline] |
Returns the corresponding (i,j,k) coordinates in the grid of point (x,y,z).
Definition at line 443 of file voxel_grid.h.
std::vector<int> pcl::VoxelGrid< sensor_msgs::PointCloud2 >::getLeafLayout | ( | ) | [inline] |
Returns the layout of the leafs for fast access to cells relative to current position.
Definition at line 439 of file voxel_grid.h.
Eigen::Vector3f pcl::VoxelGrid< sensor_msgs::PointCloud2 >::getLeafSize | ( | ) | [inline] |
Get the voxel grid leaf size.
Definition at line 348 of file voxel_grid.h.
Eigen::Vector3i pcl::VoxelGrid< sensor_msgs::PointCloud2 >::getMaxBoxCoordinates | ( | ) | [inline] |
Get the minimum coordinates of the bounding box (after filtering is performed).
Definition at line 377 of file voxel_grid.h.
Eigen::Vector3i pcl::VoxelGrid< sensor_msgs::PointCloud2 >::getMinBoxCoordinates | ( | ) | [inline] |
Get the minimum coordinates of the bounding box (after filtering is performed).
Definition at line 373 of file voxel_grid.h.
std::vector<int> pcl::VoxelGrid< sensor_msgs::PointCloud2 >::getNeighborCentroidIndices | ( | float | x, | |
float | y, | |||
float | z, | |||
std::vector< Eigen::Vector3i > | relative_coordinates | |||
) | [inline] |
Definition at line 425 of file voxel_grid.h.
std::vector<int> pcl::VoxelGrid< sensor_msgs::PointCloud2 >::getNeighborCentroidIndices | ( | float | x, | |
float | y, | |||
float | z, | |||
Eigen::MatrixXi | relative_coordinates | |||
) | [inline] |
Returns the indices in the resulting downsampled cloud of the points at the specified grid coordinates, relative to the grid coordinates of the specified point (or -1 if the cell was empty/out of bounds).
x | the X coordinate of the reference point (corresponding cell is allowed to be empty/out of bounds) | |
y | the Y coordinate of the reference point (corresponding cell is allowed to be empty/out of bounds) | |
z | the Z coordinate of the reference point (corresponding cell is allowed to be empty/out of bounds) | |
relative_coordinates | matrix with the columns being the coordinates of the requested cells, relative to the reference point's cell |
Definition at line 406 of file voxel_grid.h.
Eigen::Vector3i pcl::VoxelGrid< sensor_msgs::PointCloud2 >::getNrDivisions | ( | ) | [inline] |
Get the number of divisions along all 3 axes (after filtering is performed).
Definition at line 381 of file voxel_grid.h.
bool pcl::VoxelGrid< sensor_msgs::PointCloud2 >::getSaveLeafLayout | ( | ) | [inline] |
Returns true if leaf layout information will to be saved for later access.
Definition at line 369 of file voxel_grid.h.
void pcl::VoxelGrid< sensor_msgs::PointCloud2 >::setDownsampleAllData | ( | bool | downsample | ) | [inline] |
Set to true if all fields need to be downsampled, or false if just XYZ.
downsample | the new value (true/false) |
Definition at line 354 of file voxel_grid.h.
void pcl::VoxelGrid< sensor_msgs::PointCloud2 >::setLeafSize | ( | float | lx, | |
float | ly, | |||
float | lz | |||
) | [inline] |
Set the voxel grid leaf size.
lx | the leaf size for X | |
ly | the leaf size for Y | |
lz | the leaf size for Z |
Definition at line 341 of file voxel_grid.h.
void pcl::VoxelGrid< sensor_msgs::PointCloud2 >::setLeafSize | ( | const Eigen::Vector4f & | leaf_size | ) | [inline] |
Set the voxel grid leaf size.
leaf_size | the voxel grid leaf size |
Definition at line 333 of file voxel_grid.h.
void pcl::VoxelGrid< sensor_msgs::PointCloud2 >::setSaveLeafLayout | ( | bool | save_leaf_layout | ) | [inline] |
Set to true if leaf layout information needs to be saved for later access.
save_leaf_layout | the new value (true/false) |
Definition at line 365 of file voxel_grid.h.
Eigen::Vector4i pcl::VoxelGrid< sensor_msgs::PointCloud2 >::div_b_ [protected] |
Definition at line 487 of file voxel_grid.h.
Eigen::Vector4i pcl::VoxelGrid< sensor_msgs::PointCloud2 >::divb_mul_ [protected] |
Definition at line 487 of file voxel_grid.h.
bool pcl::VoxelGrid< sensor_msgs::PointCloud2 >::downsample_all_data_ [protected] |
Set to true if all fields need to be downsampled, or false if just XYZ.
Definition at line 478 of file voxel_grid.h.
std::vector<int> pcl::VoxelGrid< sensor_msgs::PointCloud2 >::leaf_layout_ [protected] |
The leaf layout information for fast access to cells relative to current position.
Definition at line 484 of file voxel_grid.h.
Eigen::Vector4f pcl::VoxelGrid< sensor_msgs::PointCloud2 >::leaf_size_ [protected] |
The size of a leaf.
Definition at line 475 of file voxel_grid.h.
std::map<size_t, Leaf> pcl::VoxelGrid< sensor_msgs::PointCloud2 >::leaves_ [protected] |
The 3D grid leaves.
Definition at line 472 of file voxel_grid.h.
Eigen::Vector4i pcl::VoxelGrid< sensor_msgs::PointCloud2 >::max_b_ [protected] |
Definition at line 487 of file voxel_grid.h.
Eigen::Vector4i pcl::VoxelGrid< sensor_msgs::PointCloud2 >::min_b_ [protected] |
The minimum and maximum bin coordinates, the number of divisions, and the division multiplier.
Definition at line 487 of file voxel_grid.h.
bool pcl::VoxelGrid< sensor_msgs::PointCloud2 >::save_leaf_layout_ [protected] |
Set to true if leaf layout information needs to be saved in leaf_layout_.
Definition at line 481 of file voxel_grid.h.