40 #ifndef PCL_OCTREE_VOXELCENTROID_H
41 #define PCL_OCTREE_VOXELCENTROID_H
43 #include "octree_pointcloud.h"
45 #include <pcl/common/point_operators.h>
46 #include <pcl/point_types.h>
47 #include <pcl/register_point_struct.h>
57 template<
typename Po
intT>
93 using namespace pcl::common;
97 point_sum_ += new_point;
106 using namespace pcl::common;
110 centroid_arg = point_sum_;
111 centroid_arg /=
static_cast<float> (point_counter_);
115 centroid_arg *= 0.0f;
123 using namespace pcl::common;
130 unsigned int point_counter_;
144 typename LeafContainerT = OctreePointCloudVoxelCentroidContainer<PointT> ,
145 typename BranchContainerT = OctreeContainerEmpty >
149 typedef boost::shared_ptr<OctreePointCloudVoxelCentroid<PointT, LeafContainerT> >
Ptr;
150 typedef boost::shared_ptr<const OctreePointCloudVoxelCentroid<PointT, LeafContainerT> >
ConstPtr;
179 assert (pointIdx_arg < static_cast<int> (this->input_->points.size ()));
181 const PointT& point = this->input_->points[pointIdx_arg];
184 this->adoptBoundingBoxToPoint (point);
187 this->genOctreeKeyforPoint (point, key);
190 LeafContainerT* container = this->createLeaf(key);
191 container->addPoint (point);
201 getVoxelCentroidAtPoint (
const PointT& point_arg,
PointT& voxel_centroid_arg)
const;
212 return (this->getVoxelCentroidAtPoint (this->input_->points[point_idx_arg], voxel_centroid_arg));
228 getVoxelCentroidsRecursive (
const BranchNode* branch_arg,
236 #include <pcl/octree/impl/octree_pointcloud_voxelcentroid.hpp>
OctreeT::BranchNode BranchNode
virtual void reset()
Reset leaf container.
OctreePointCloud< PointT, LeafContainerT, BranchContainerT > OctreeT
Octree pointcloud voxel centroid class
OctreePointCloudVoxelCentroidContainer()
Class initialization.
OctreePointCloudVoxelCentroid(const double resolution_arg)
OctreePointCloudVoxelCentroids class constructor.
virtual ~OctreePointCloudVoxelCentroidContainer()
Empty class deconstructor.
virtual void addPointIdx(const int pointIdx_arg)
Add DataT object to leaf node at octree key.
virtual OctreePointCloudVoxelCentroidContainer * deepCopy() const
deep copy function
Octree container class that can serve as a base to construct own leaf node container classes...
OctreeT::LeafNode LeafNode
boost::shared_ptr< const OctreePointCloudVoxelCentroid< PointT, LeafContainerT > > ConstPtr
OctreeT::BranchNode BranchNode
virtual ~OctreePointCloudVoxelCentroid()
Empty class deconstructor.
void addPoint(const PointT &new_point)
Add new point to voxel.
virtual bool operator==(const OctreeContainerBase &) const
Equal comparison operator - set to false.
boost::shared_ptr< OctreePointCloudVoxelCentroid< PointT, LeafContainerT > > Ptr
Octree pointcloud voxel centroid leaf node class
OctreeT::LeafNode LeafNode
A point structure representing Euclidean xyz coordinates, and the RGB color.
bool getVoxelCentroidAtPoint(const int &point_idx_arg, PointT &voxel_centroid_arg) const
Get centroid for a single voxel addressed by a PointT point from input cloud.
void getCentroid(PointT ¢roid_arg) const
Calculate centroid of voxel.