Point Cloud Library (PCL)
1.10.0
|
43 #include <boost/version.hpp>
45 #include <pcl/features/normal_3d.h>
46 #include <pcl/pcl_base.h>
48 #include <pcl/point_cloud.h>
50 #include <pcl/octree/octree_search.h>
51 #include <pcl/octree/octree_pointcloud_adjacency.h>
52 #include <pcl/search/search.h>
53 #include <pcl/segmentation/boost.h>
65 template <
typename Po
intT>
96 normal_arg.normal_x =
normal_.normal_x;
97 normal_arg.normal_y =
normal_.normal_y;
98 normal_arg.normal_z =
normal_.normal_z;
124 template <
typename Po
intT>
128 class SupervoxelHelper;
129 friend class SupervoxelHelper;
138 xyz_ (0.0f, 0.0f, 0.0f),
139 rgb_ (0.0f, 0.0f, 0.0f),
140 normal_ (0.0f, 0.0f, 0.0f, 0.0f),
151 getPoint (
PointT &point_arg)
const;
157 getNormal (
Normal &normal_arg)
const;
185 using VoxelAdjacencyList = boost::adjacency_list<boost::setS, boost::setS, boost::undirectedS, std::uint32_t, float>;
186 using VoxelID = VoxelAdjacencyList::vertex_descriptor;
187 using EdgeID = VoxelAdjacencyList::edge_descriptor;
197 [[deprecated(
"constructor with flag for using the single camera transform is deprecated. Default behavior is now to use the transform for organized clouds, and not use it for unorganized. Use setUseSingleCameraTransform() to override the defaults.")]]
208 setVoxelResolution (
float resolution);
212 getVoxelResolution ()
const;
216 setSeedResolution (
float seed_resolution);
220 getSeedResolution ()
const;
224 setColorImportance (
float val);
228 setSpatialImportance (
float val);
232 setNormalImportance (
float val);
245 setUseSingleCameraTransform (
bool val);
264 setNormalCloud (
typename NormalCloudT::ConstPtr normal_cloud);
281 [[deprecated(
"use getLabeledCloud() instead. An example of how to display and save with colorized labels can be found in examples/segmentation/example_supervoxels.cpp")]]
290 getVoxelCentroidCloud ()
const;
297 getLabeledCloud ()
const;
304 getLabeledVoxelCloud ()
const;
310 getSupervoxelAdjacencyList (VoxelAdjacencyList &adjacency_list_arg)
const;
316 getSupervoxelAdjacency (std::multimap<std::uint32_t, std::uint32_t> &label_adjacency)
const;
328 getMaxLabel ()
const;
335 prepareForSegmentation ();
341 selectInitialSupervoxelSeeds (std::vector<int> &seed_indices);
347 createSupervoxelHelpers (std::vector<int> &seed_indices);
351 expandSupervoxels (
int depth);
359 reseedSupervoxels ();
369 float seed_resolution_;
373 voxelDataDistance (
const VoxelData &v1,
const VoxelData &v2)
const;
377 transformFunction (
PointT &p);
383 typename OctreeAdjacencyT::Ptr adjacency_octree_;
389 typename NormalCloudT::ConstPtr input_normals_;
392 float color_importance_;
394 float spatial_importance_;
396 float normal_importance_;
402 bool use_single_camera_transform_;
404 bool use_default_transform_behaviour_;
410 class SupervoxelHelper
422 return leaf_data_left.
idx_ < leaf_data_right.
idx_;
425 using LeafSetT = std::set<LeafContainerT*, typename SupervoxelHelper::compareLeaves>;
426 using iterator =
typename LeafSetT::iterator;
427 using const_iterator =
typename LeafSetT::const_iterator;
435 addLeaf (LeafContainerT* leaf_arg);
438 removeLeaf (LeafContainerT* leaf_arg);
466 {
return centroid_.normal_; }
470 {
return centroid_.rgb_; }
474 {
return centroid_.xyz_;}
477 getXYZ (
float &x,
float &y,
float &z)
const
478 { x=centroid_.xyz_[0]; y=centroid_.xyz_[1]; z=centroid_.xyz_[2]; }
483 rgba = static_cast<std::uint32_t>(centroid_.rgb_[0]) << 16 |
484 static_cast<std::uint32_t>(centroid_.rgb_[1]) << 8 |
485 static_cast<std::uint32_t>(centroid_.rgb_[2]);
491 normal_arg.normal_x = centroid_.normal_[0];
492 normal_arg.normal_y = centroid_.normal_[1];
493 normal_arg.normal_z = centroid_.normal_[2];
494 normal_arg.
curvature = centroid_.curvature_;
498 getNeighborLabels (std::set<std::uint32_t> &neighbor_labels)
const;
502 {
return centroid_; }
505 size ()
const {
return leaves_.size (); }
511 SupervoxelClustering* parent_;
518 #if BOOST_VERSION >= 107000
524 using HelperListT = boost::ptr_list<SupervoxelHelper>;
525 HelperListT supervoxel_helpers_;
535 #ifdef PCL_NO_PRECOMPILE
536 #include <pcl/segmentation/impl/supervoxel_clustering.hpp>
pcl::PointCloud< Normal >::Ptr normals_
A Pointcloud of the normals for the points in the supervoxel.
Defines all the PCL and non-PCL macros used.
This file defines compatibility wrappers for low level I/O functions.
A point structure representing normal coordinates and the surface curvature estimate.
shared_ptr< Indices > IndicesPtr
pcl::PointCloud< PointXYZRGBA >::Ptr getColoredCloud() const
Returns an RGB colorized cloud showing superpixels Otherwise it returns an empty pointer.
VoxelAdjacencyList::vertex_descriptor VoxelID
PointCloud represents the base class in PCL for storing collections of 3D points.
void getCentroidPointNormal(PointNormal &normal_arg)
Gets the point normal for the supervoxel.
VoxelData is a structure used for storing data within a pcl::octree::OctreePointCloudAdjacencyContain...
A point structure representing Euclidean xyz coordinates, and the RGB color.
shared_ptr< KdTree< PointT, Tree > > Ptr
Implements a supervoxel algorithm based on voxel structure, normals, and rgb values.
A point structure representing Euclidean xyz coordinates, and the RGBA color.
pcl::PointXYZRGBA centroid_
The centroid of the supervoxel - average voxel.
Octree adjacency leaf container class- stores a list of pointers to neighbors, number of points added...
#define PCL_MAKE_ALIGNED_OPERATOR_NEW
Macro to signal a class requires a custom allocator.
std::vector< LeafContainerT * > LeafVectorT
Comparator for LeafContainerT pointers - used for sorting set of leaves.
shared_ptr< const Supervoxel< PointT > > ConstPtr
Octree pointcloud voxel class which maintains adjacency information for its voxels.
A point structure representing Euclidean xyz coordinates, together with normal coordinates and the su...
DataT & getData()
Returns a reference to the data member to access it without copying.
pcl::PointCloud< PointT >::Ptr voxels_
A Pointcloud of the voxels in the supervoxel.
pcl::Normal normal_
The normal calculated for the voxels contained in the supervoxel.
shared_ptr< Supervoxel< PointT > > Ptr
void getCentroidPoint(PointXYZRGBA ¢roid_arg)
Gets the centroid of the supervoxel.
shared_ptr< PointCloud< PointT > > Ptr
VoxelAdjacencyList::edge_descriptor EdgeID
SupervoxelClustering(float voxel_resolution, float seed_resolution, bool)
shared_ptr< const PointCloud< PointT > > ConstPtr
SupervoxelHelper * owner_
Octree pointcloud search class
pcl::IndicesPtr IndicesPtr
boost::adjacency_list< boost::setS, boost::setS, boost::undirectedS, std::uint32_t, float > VoxelAdjacencyList
boost::shared_ptr< T > shared_ptr
Alias for boost::shared_ptr.
Supervoxel container class - stores a cluster extracted using supervoxel clustering.