Point Cloud Library (PCL)
1.11.0
|
Octree pointcloud voxel class which maintains adjacency information for its voxels. More...
#include <pcl/octree/octree_pointcloud_adjacency.h>
Public Types | |
using | OctreeBaseT = OctreeBase< LeafContainerT, BranchContainerT > |
using | OctreeAdjacencyT = OctreePointCloudAdjacency< PointT, LeafContainerT, BranchContainerT > |
using | Ptr = shared_ptr< OctreeAdjacencyT > |
using | ConstPtr = shared_ptr< const OctreeAdjacencyT > |
using | OctreePointCloudT = OctreePointCloud< PointT, LeafContainerT, BranchContainerT, OctreeBaseT > |
using | LeafNode = typename OctreePointCloudT::LeafNode |
using | BranchNode = typename OctreePointCloudT::BranchNode |
using | PointCloud = pcl::PointCloud< PointT > |
using | PointCloudPtr = typename PointCloud::Ptr |
using | PointCloudConstPtr = typename PointCloud::ConstPtr |
using | VoxelAdjacencyList = boost::adjacency_list< boost::setS, boost::setS, boost::undirectedS, PointT, float > |
using | VoxelID = typename VoxelAdjacencyList::vertex_descriptor |
using | EdgeID = typename VoxelAdjacencyList::edge_descriptor |
using | LeafVectorT = std::vector< LeafContainerT * > |
using | iterator = typename LeafVectorT::iterator |
using | const_iterator = typename LeafVectorT::const_iterator |
![]() | |
using | Base = OctreeT |
using | LeafNode = typename OctreeT::LeafNode |
using | BranchNode = typename OctreeT::BranchNode |
using | IndicesPtr = shared_ptr< std::vector< int >> |
using | IndicesConstPtr = shared_ptr< const std::vector< int >> |
using | PointCloud = pcl::PointCloud< PointT > |
using | PointCloudPtr = typename PointCloud::Ptr |
using | PointCloudConstPtr = typename PointCloud::ConstPtr |
using | SingleBuffer = OctreePointCloud< PointT, LeafContainerT, BranchContainerT, OctreeBase< LeafContainerT >> |
using | Ptr = shared_ptr< OctreePointCloud< PointT, LeafContainerT, BranchContainerT, OctreeT >> |
using | ConstPtr = shared_ptr< const OctreePointCloud< PointT, LeafContainerT, BranchContainerT, OctreeT >> |
using | AlignedPointTVector = std::vector< PointT, Eigen::aligned_allocator< PointT >> |
using | AlignedPointXYZVector = std::vector< PointXYZ, Eigen::aligned_allocator< PointXYZ >> |
Public Member Functions | |
iterator | begin () |
iterator | end () |
LeafContainerT * | at (std::size_t idx) |
std::size_t | size () const |
OctreePointCloudAdjacency (const double resolution_arg) | |
Constructor. More... | |
void | addPointsFromInputCloud () |
Adds points from cloud to the octree. More... | |
LeafContainerT * | getLeafContainerAtPoint (const PointT &point_arg) const |
Gets the leaf container for a given point. More... | |
void | computeVoxelAdjacencyGraph (VoxelAdjacencyList &voxel_adjacency_graph) |
Computes an adjacency graph of voxel relations. More... | |
void | setTransformFunction (std::function< void(PointT &p)> transform_func) |
Sets a point transform (and inverse) used to transform the space of the input cloud. More... | |
bool | testForOcclusion (const PointT &point_arg, const PointXYZ &camera_pos=PointXYZ(0, 0, 0)) |
Tests whether input point is occluded from specified camera point by other voxels. More... | |
![]() | |
OctreePointCloud (const double resolution_arg) | |
Octree pointcloud constructor. More... | |
void | setInputCloud (const PointCloudConstPtr &cloud_arg, const IndicesConstPtr &indices_arg=IndicesConstPtr()) |
Provide a pointer to the input data set. More... | |
IndicesConstPtr const | getIndices () const |
Get a pointer to the vector of indices used. More... | |
PointCloudConstPtr | getInputCloud () const |
Get a pointer to the input point cloud dataset. More... | |
void | setEpsilon (double eps) |
Set the search epsilon precision (error bound) for nearest neighbors searches. More... | |
double | getEpsilon () const |
Get the search epsilon precision (error bound) for nearest neighbors searches. More... | |
void | setResolution (double resolution_arg) |
Set/change the octree voxel resolution. More... | |
double | getResolution () const |
Get octree voxel resolution. More... | |
unsigned int | getTreeDepth () const |
Get the maximum depth of the octree. More... | |
void | addPointsFromInputCloud () |
Add points from input point cloud to octree. More... | |
void | addPointFromCloud (const int point_idx_arg, IndicesPtr indices_arg) |
Add point at given index from input point cloud to octree. More... | |
void | addPointToCloud (const PointT &point_arg, PointCloudPtr cloud_arg) |
Add point simultaneously to octree and input point cloud. More... | |
void | addPointToCloud (const PointT &point_arg, PointCloudPtr cloud_arg, IndicesPtr indices_arg) |
Add point simultaneously to octree and input point cloud. More... | |
bool | isVoxelOccupiedAtPoint (const PointT &point_arg) const |
Check if voxel at given point exist. More... | |
bool | isVoxelOccupiedAtPoint (const double point_x_arg, const double point_y_arg, const double point_z_arg) const |
Check if voxel at given point coordinates exist. More... | |
bool | isVoxelOccupiedAtPoint (const int &point_idx_arg) const |
Check if voxel at given point from input cloud exist. More... | |
void | deleteTree () |
Delete the octree structure and its leaf nodes. More... | |
int | getOccupiedVoxelCenters (AlignedPointTVector &voxel_center_list_arg) const |
Get a PointT vector of centers of all occupied voxels. More... | |
int | getApproxIntersectedVoxelCentersBySegment (const Eigen::Vector3f &origin, const Eigen::Vector3f &end, AlignedPointTVector &voxel_center_list, float precision=0.2) |
Get a PointT vector of centers of voxels intersected by a line segment. More... | |
void | deleteVoxelAtPoint (const PointT &point_arg) |
Delete leaf node / voxel at given point. More... | |
void | deleteVoxelAtPoint (const int &point_idx_arg) |
Delete leaf node / voxel at given point from input cloud. More... | |
void | defineBoundingBox () |
Investigate dimensions of pointcloud data set and define corresponding bounding box for octree. More... | |
void | defineBoundingBox (const double min_x_arg, const double min_y_arg, const double min_z_arg, const double max_x_arg, const double max_y_arg, const double max_z_arg) |
Define bounding box for octree. More... | |
void | defineBoundingBox (const double max_x_arg, const double max_y_arg, const double max_z_arg) |
Define bounding box for octree. More... | |
void | defineBoundingBox (const double cubeLen_arg) |
Define bounding box cube for octree. More... | |
void | getBoundingBox (double &min_x_arg, double &min_y_arg, double &min_z_arg, double &max_x_arg, double &max_y_arg, double &max_z_arg) const |
Get bounding box for octree. More... | |
double | getVoxelSquaredDiameter (unsigned int tree_depth_arg) const |
Calculates the squared diameter of a voxel at given tree depth. More... | |
double | getVoxelSquaredDiameter () const |
Calculates the squared diameter of a voxel at leaf depth. More... | |
double | getVoxelSquaredSideLen (unsigned int tree_depth_arg) const |
Calculates the squared voxel cube side length at given tree depth. More... | |
double | getVoxelSquaredSideLen () const |
Calculates the squared voxel cube side length at leaf level. More... | |
void | getVoxelBounds (const OctreeIteratorBase< OctreeT > &iterator, Eigen::Vector3f &min_pt, Eigen::Vector3f &max_pt) const |
Generate bounds of the current voxel of an octree iterator. More... | |
void | enableDynamicDepth (std::size_t maxObjsPerLeaf) |
Enable dynamic octree structure. More... | |
Protected Member Functions | |
void | addPointIdx (const int point_idx_arg) override |
Add point at index from input pointcloud dataset to octree. More... | |
void | computeNeighbors (OctreeKey &key_arg, LeafContainerT *leaf_container) |
Fills in the neighbors fields for new voxels. More... | |
void | genOctreeKeyforPoint (const PointT &point_arg, OctreeKey &key_arg) const |
Generates octree key for specified point (uses transform if provided). More... | |
![]() | |
void | expandLeafNode (LeafNode *leaf_node, BranchNode *parent_branch, unsigned char child_idx, unsigned int depth_mask) |
Add point at index from input pointcloud dataset to octree. More... | |
const PointT & | getPointByIndex (const unsigned int index_arg) const |
Get point at index from input pointcloud dataset. More... | |
LeafContainerT * | findLeafAtPoint (const PointT &point_arg) const |
Find octree leaf node at a given point. More... | |
void | getKeyBitSize () |
Define octree key setting and octree depth based on defined bounding box. More... | |
void | adoptBoundingBoxToPoint (const PointT &point_idx_arg) |
Grow the bounding box/octree until point fits. More... | |
bool | isPointWithinBoundingBox (const PointT &point_idx_arg) const |
Checks if given point is within the bounding box of the octree. More... | |
void | genOctreeKeyforPoint (const PointT &point_arg, OctreeKey &key_arg) const |
Generate octree key for voxel at a given point. More... | |
void | genOctreeKeyforPoint (const double point_x_arg, const double point_y_arg, const double point_z_arg, OctreeKey &key_arg) const |
Generate octree key for voxel at a given point. More... | |
virtual bool | genOctreeKeyForDataT (const int &data_arg, OctreeKey &key_arg) const |
Virtual method for generating octree key for a given point index. More... | |
void | genLeafNodeCenterFromOctreeKey (const OctreeKey &key_arg, PointT &point_arg) const |
Generate a point at center of leaf node voxel. More... | |
void | genVoxelCenterFromOctreeKey (const OctreeKey &key_arg, unsigned int tree_depth_arg, PointT &point_arg) const |
Generate a point at center of octree voxel at given tree level. More... | |
void | genVoxelBoundsFromOctreeKey (const OctreeKey &key_arg, unsigned int tree_depth_arg, Eigen::Vector3f &min_pt, Eigen::Vector3f &max_pt) const |
Generate bounds of an octree voxel using octree key and tree depth arguments. More... | |
int | getOccupiedVoxelCentersRecursive (const BranchNode *node_arg, const OctreeKey &key_arg, AlignedPointTVector &voxel_center_list_arg) const |
Recursively search the tree for all leaf nodes and return a vector of voxel centers. More... | |
Additional Inherited Members | |
![]() | |
PointCloudConstPtr | input_ |
Pointer to input point cloud dataset. More... | |
IndicesConstPtr | indices_ |
A pointer to the vector of point indices to use. More... | |
double | epsilon_ |
Epsilon precision (error bound) for nearest neighbors searches. More... | |
double | resolution_ |
Octree resolution. More... | |
double | min_x_ |
double | max_x_ |
double | min_y_ |
double | max_y_ |
double | min_z_ |
double | max_z_ |
bool | bounding_box_defined_ |
Flag indicating if octree has defined bounding box. More... | |
std::size_t | max_objs_per_leaf_ |
Amount of DataT objects per leafNode before expanding branch. More... | |
Octree pointcloud voxel class which maintains adjacency information for its voxels.
This pointcloud octree class generates an octree from a point cloud (zero-copy). The octree pointcloud is initialized with its voxel resolution. Its bounding box is automatically adjusted or can be predefined.
The OctreePointCloudAdjacencyContainer class can be used to store data in leaf nodes.
An optional transform function can be provided which changes how the voxel grid is computed - this can be used to, for example, make voxel bins larger as they increase in distance from the origin (camera).
If used in academic work, please cite:
Definition at line 80 of file octree_pointcloud_adjacency.h.
using pcl::octree::OctreePointCloudAdjacency< PointT, LeafContainerT, BranchContainerT >::BranchNode = typename OctreePointCloudT::BranchNode |
Definition at line 94 of file octree_pointcloud_adjacency.h.
using pcl::octree::OctreePointCloudAdjacency< PointT, LeafContainerT, BranchContainerT >::const_iterator = typename LeafVectorT::const_iterator |
Definition at line 111 of file octree_pointcloud_adjacency.h.
using pcl::octree::OctreePointCloudAdjacency< PointT, LeafContainerT, BranchContainerT >::ConstPtr = shared_ptr<const OctreeAdjacencyT> |
Definition at line 89 of file octree_pointcloud_adjacency.h.
using pcl::octree::OctreePointCloudAdjacency< PointT, LeafContainerT, BranchContainerT >::EdgeID = typename VoxelAdjacencyList::edge_descriptor |
Definition at line 104 of file octree_pointcloud_adjacency.h.
using pcl::octree::OctreePointCloudAdjacency< PointT, LeafContainerT, BranchContainerT >::iterator = typename LeafVectorT::iterator |
Definition at line 110 of file octree_pointcloud_adjacency.h.
using pcl::octree::OctreePointCloudAdjacency< PointT, LeafContainerT, BranchContainerT >::LeafNode = typename OctreePointCloudT::LeafNode |
Definition at line 93 of file octree_pointcloud_adjacency.h.
using pcl::octree::OctreePointCloudAdjacency< PointT, LeafContainerT, BranchContainerT >::LeafVectorT = std::vector<LeafContainerT*> |
Definition at line 107 of file octree_pointcloud_adjacency.h.
using pcl::octree::OctreePointCloudAdjacency< PointT, LeafContainerT, BranchContainerT >::OctreeAdjacencyT = OctreePointCloudAdjacency<PointT, LeafContainerT, BranchContainerT> |
Definition at line 87 of file octree_pointcloud_adjacency.h.
using pcl::octree::OctreePointCloudAdjacency< PointT, LeafContainerT, BranchContainerT >::OctreeBaseT = OctreeBase<LeafContainerT, BranchContainerT> |
Definition at line 84 of file octree_pointcloud_adjacency.h.
using pcl::octree::OctreePointCloudAdjacency< PointT, LeafContainerT, BranchContainerT >::OctreePointCloudT = OctreePointCloud<PointT, LeafContainerT, BranchContainerT, OctreeBaseT> |
Definition at line 92 of file octree_pointcloud_adjacency.h.
using pcl::octree::OctreePointCloudAdjacency< PointT, LeafContainerT, BranchContainerT >::PointCloud = pcl::PointCloud<PointT> |
Definition at line 96 of file octree_pointcloud_adjacency.h.
using pcl::octree::OctreePointCloudAdjacency< PointT, LeafContainerT, BranchContainerT >::PointCloudConstPtr = typename PointCloud::ConstPtr |
Definition at line 98 of file octree_pointcloud_adjacency.h.
using pcl::octree::OctreePointCloudAdjacency< PointT, LeafContainerT, BranchContainerT >::PointCloudPtr = typename PointCloud::Ptr |
Definition at line 97 of file octree_pointcloud_adjacency.h.
using pcl::octree::OctreePointCloudAdjacency< PointT, LeafContainerT, BranchContainerT >::Ptr = shared_ptr<OctreeAdjacencyT> |
Definition at line 88 of file octree_pointcloud_adjacency.h.
using pcl::octree::OctreePointCloudAdjacency< PointT, LeafContainerT, BranchContainerT >::VoxelAdjacencyList = boost:: adjacency_list<boost::setS, boost::setS, boost::undirectedS, PointT, float> |
Definition at line 102 of file octree_pointcloud_adjacency.h.
using pcl::octree::OctreePointCloudAdjacency< PointT, LeafContainerT, BranchContainerT >::VoxelID = typename VoxelAdjacencyList::vertex_descriptor |
Definition at line 103 of file octree_pointcloud_adjacency.h.
pcl::octree::OctreePointCloudAdjacency< PointT, LeafContainerT, BranchContainerT >::OctreePointCloudAdjacency | ( | const double | resolution_arg | ) |
Constructor.
[in] | resolution_arg | Octree resolution at lowest octree level (voxel size) |
Definition at line 56 of file octree_pointcloud_adjacency.hpp.
|
overrideprotectedvirtual |
Add point at index from input pointcloud dataset to octree.
[in] | point_idx_arg | The index representing the point in the dataset given by setInputCloud() to be added |
Reimplemented from pcl::octree::OctreePointCloud< PointT, LeafContainerT, BranchContainerT >.
Definition at line 157 of file octree_pointcloud_adjacency.hpp.
References pcl::isFinite().
void pcl::octree::OctreePointCloudAdjacency< PointT, LeafContainerT, BranchContainerT >::addPointsFromInputCloud | ( | ) |
Adds points from cloud to the octree.
Definition at line 67 of file octree_pointcloud_adjacency.hpp.
References pcl::octree::OctreePointCloud< PointT, LeafContainerT, BranchContainerT, OctreeT >::addPointsFromInputCloud(), and pcl::isFinite().
|
inline |
Definition at line 124 of file octree_pointcloud_adjacency.h.
|
inline |
Definition at line 114 of file octree_pointcloud_adjacency.h.
|
protected |
Fills in the neighbors fields for new voxels.
[in] | key_arg | Key of the voxel to check neighbors for |
[in] | leaf_container | Pointer to container of the leaf to check neighbors for |
Definition at line 178 of file octree_pointcloud_adjacency.hpp.
References pcl::octree::OctreeKey::x, pcl::octree::OctreeKey::y, and pcl::octree::OctreeKey::z.
void pcl::octree::OctreePointCloudAdjacency< PointT, LeafContainerT, BranchContainerT >::computeVoxelAdjacencyGraph | ( | VoxelAdjacencyList & | voxel_adjacency_graph | ) |
Computes an adjacency graph of voxel relations.
[out] | voxel_adjacency_graph | Boost Graph Library Adjacency graph of the voxel touching relationships. Vertices are PointT, edges represent touching, and edge lengths are the distance between the points. |
Definition at line 231 of file octree_pointcloud_adjacency.hpp.
|
inline |
Definition at line 119 of file octree_pointcloud_adjacency.h.
|
protected |
Generates octree key for specified point (uses transform if provided).
[in] | point_arg | Point to generate key for |
[out] | key_arg | Resulting octree key |
Definition at line 122 of file octree_pointcloud_adjacency.hpp.
References pcl::isFinite(), pcl::octree::OctreeKey::x, pcl::octree::OctreeKey::y, and pcl::octree::OctreeKey::z.
LeafContainerT * pcl::octree::OctreePointCloudAdjacency< PointT, LeafContainerT, BranchContainerT >::getLeafContainerAtPoint | ( | const PointT & | point_arg | ) | const |
Gets the leaf container for a given point.
[in] | point_arg | Point to search for |
Definition at line 215 of file octree_pointcloud_adjacency.hpp.
|
inline |
Sets a point transform (and inverse) used to transform the space of the input cloud.
This is useful for changing how adjacency is calculated - such as relaxing the adjacency criterion for points further from the camera.
[in] | transform_func | A boost:function pointer to the transform to be used. The transform must have one parameter (a point) which it modifies in place. |
Definition at line 175 of file octree_pointcloud_adjacency.h.
|
inline |
Definition at line 131 of file octree_pointcloud_adjacency.h.
bool pcl::octree::OctreePointCloudAdjacency< PointT, LeafContainerT, BranchContainerT >::testForOcclusion | ( | const PointT & | point_arg, |
const PointXYZ & | camera_pos = PointXYZ(0, 0, 0) |
||
) |
Tests whether input point is occluded from specified camera point by other voxels.
[in] | point_arg | Point to test for |
[in] | camera_pos | Position of camera, defaults to origin |
Definition at line 278 of file octree_pointcloud_adjacency.hpp.
References pcl::octree::OctreeKey::x, pcl::octree::OctreeKey::y, and pcl::octree::OctreeKey::z.