40 #ifndef PCL_SEGMENTATION_SUPERVOXEL_CLUSTERING_HPP_ 41 #define PCL_SEGMENTATION_SUPERVOXEL_CLUSTERING_HPP_ 43 #include <pcl/segmentation/supervoxel_clustering.h> 46 template <
typename Po
intT>
48 resolution_ (voxel_resolution),
49 seed_resolution_ (seed_resolution),
51 voxel_centroid_cloud_ (),
52 color_importance_ (0.1f),
53 spatial_importance_ (0.4f),
54 normal_importance_ (1.0f),
55 use_default_transform_behaviour_ (true)
61 template <
typename Po
intT>
63 resolution_ (voxel_resolution),
64 seed_resolution_ (seed_resolution),
66 voxel_centroid_cloud_ (),
67 color_importance_ (0.1f),
68 spatial_importance_ (0.4f),
69 normal_importance_ (1.0f),
70 use_default_transform_behaviour_ (true)
76 template <
typename Po
intT>
83 template <
typename Po
intT>
void 86 if ( cloud->
size () == 0 )
88 PCL_ERROR (
"[pcl::SupervoxelClustering::setInputCloud] Empty cloud set, doing nothing \n");
93 adjacency_octree_->setInputCloud (cloud);
97 template <
typename Po
intT>
void 100 if ( normal_cloud->size () == 0 )
102 PCL_ERROR (
"[pcl::SupervoxelClustering::setNormalCloud] Empty cloud set, doing nothing \n");
106 input_normals_ = normal_cloud;
110 template <
typename Po
intT>
void 117 if ( !segmentation_is_possible )
124 segmentation_is_possible = prepareForSegmentation ();
125 if ( !segmentation_is_possible )
133 std::vector<int> seed_indices;
134 selectInitialSupervoxelSeeds (seed_indices);
136 createSupervoxelHelpers (seed_indices);
141 int max_depth =
static_cast<int> (1.8f*seed_resolution_/resolution_);
142 expandSupervoxels (max_depth);
146 makeSupervoxels (supervoxel_clusters);
162 template <
typename Po
intT>
void 165 if (supervoxel_helpers_.size () == 0)
167 PCL_ERROR (
"[pcl::SupervoxelClustering::refineVoxelNormals] Supervoxels not extracted, doing nothing - (Call extract first!) \n");
171 int max_depth =
static_cast<int> (1.8f*seed_resolution_/resolution_);
172 for (
int i = 0; i < num_itr; ++i)
174 for (
typename HelperListT::iterator sv_itr = supervoxel_helpers_.begin (); sv_itr != supervoxel_helpers_.end (); ++sv_itr)
176 sv_itr->refineNormals ();
179 reseedSupervoxels ();
180 expandSupervoxels (max_depth);
184 makeSupervoxels (supervoxel_clusters);
194 template <
typename Po
intT>
bool 199 if (
input_->points.size () == 0 )
205 if ( (use_default_transform_behaviour_ &&
input_->isOrganized ())
206 || (!use_default_transform_behaviour_ && use_single_camera_transform_))
207 adjacency_octree_->setTransformFunction (boost::bind (&SupervoxelClustering::transformFunction,
this, _1));
209 adjacency_octree_->addPointsFromInputCloud ();
222 template <
typename Po
intT>
void 226 voxel_centroid_cloud_->resize (adjacency_octree_->getLeafCount ());
227 typename LeafVectorT::iterator leaf_itr = adjacency_octree_->begin ();
229 for (
int idx = 0 ; leaf_itr != adjacency_octree_->end (); ++leaf_itr, ++cent_cloud_itr, ++idx)
231 VoxelData& new_voxel_data = (*leaf_itr)->getData ();
233 new_voxel_data.
getPoint (*cent_cloud_itr);
235 new_voxel_data.
idx_ = idx;
242 assert (input_normals_->size () ==
input_->size ());
248 if ( !pcl::isFinite<PointT> (*input_itr))
251 LeafContainerT* leaf = adjacency_octree_->getLeafContainerAtPoint (*input_itr);
256 voxel_data.
normal_ += normal_itr->getNormalVector4fMap ();
257 voxel_data.
curvature_ += normal_itr->curvature;
260 for (leaf_itr = adjacency_octree_->begin (); leaf_itr != adjacency_octree_->end (); ++leaf_itr)
262 VoxelData& voxel_data = (*leaf_itr)->getData ();
263 voxel_data.
normal_.normalize ();
265 voxel_data.
distance_ = std::numeric_limits<float>::max ();
267 int num_points = (*leaf_itr)->getPointCounter ();
273 for (leaf_itr = adjacency_octree_->begin (); leaf_itr != adjacency_octree_->end (); ++leaf_itr)
275 VoxelData& new_voxel_data = (*leaf_itr)->getData ();
277 std::vector<int> indices;
278 indices.reserve (81);
280 indices.push_back (new_voxel_data.
idx_);
283 VoxelData& neighb_voxel_data = (*neighb_itr)->getData ();
285 indices.push_back (neighb_voxel_data.
idx_);
287 for (
typename LeafContainerT::const_iterator neighb_neighb_itr=(*neighb_itr)->cbegin (); neighb_neighb_itr!=(*neighb_itr)->cend (); ++neighb_neighb_itr)
289 VoxelData& neighb2_voxel_data = (*neighb_neighb_itr)->getData ();
290 indices.push_back (neighb2_voxel_data.
idx_);
296 new_voxel_data.
normal_[3] = 0.0f;
297 new_voxel_data.
normal_.normalize ();
298 new_voxel_data.
owner_ = 0;
299 new_voxel_data.
distance_ = std::numeric_limits<float>::max ();
307 template <
typename Po
intT>
void 312 for (
int i = 1; i < depth; ++i)
315 for (
typename HelperListT::iterator sv_itr = supervoxel_helpers_.begin (); sv_itr != supervoxel_helpers_.end (); ++sv_itr)
321 for (
typename HelperListT::iterator sv_itr = supervoxel_helpers_.begin (); sv_itr != supervoxel_helpers_.end (); )
323 if (sv_itr->size () == 0)
325 sv_itr = supervoxel_helpers_.erase (sv_itr);
329 sv_itr->updateCentroid ();
339 template <
typename Po
intT>
void 342 supervoxel_clusters.clear ();
343 for (
typename HelperListT::iterator sv_itr = supervoxel_helpers_.begin (); sv_itr != supervoxel_helpers_.end (); ++sv_itr)
345 uint32_t label = sv_itr->getLabel ();
347 sv_itr->getXYZ (supervoxel_clusters[label]->centroid_.x,supervoxel_clusters[label]->centroid_.y,supervoxel_clusters[label]->centroid_.z);
348 sv_itr->getRGB (supervoxel_clusters[label]->centroid_.rgba);
349 sv_itr->getNormal (supervoxel_clusters[label]->normal_);
350 sv_itr->getVoxels (supervoxel_clusters[label]->voxels_);
351 sv_itr->getNormals (supervoxel_clusters[label]->normals_);
357 template <
typename Po
intT>
void 361 supervoxel_helpers_.clear ();
362 for (
size_t i = 0; i < seed_indices.size (); ++i)
366 LeafContainerT* seed_leaf = adjacency_octree_->at(seed_indices[i]);
369 supervoxel_helpers_.back ().addLeaf (seed_leaf);
373 PCL_WARN (
"Could not find leaf in pcl::SupervoxelClustering<PointT>::createSupervoxelHelpers - supervoxel will be deleted \n");
379 template <
typename Po
intT>
void 391 std::vector<PointT, Eigen::aligned_allocator<PointT> > voxel_centers;
395 std::vector<int> seed_indices_orig;
396 seed_indices_orig.resize (num_seeds, 0);
397 seed_indices.clear ();
398 std::vector<int> closest_index;
400 closest_index.resize(1,0);
401 distance.resize(1,0);
402 if (voxel_kdtree_ == 0)
408 for (
int i = 0; i < num_seeds; ++i)
410 voxel_kdtree_->
nearestKSearch (voxel_centers[i], 1, closest_index, distance);
411 seed_indices_orig[i] = closest_index[0];
414 std::vector<int> neighbors;
415 std::vector<float> sqr_distances;
416 seed_indices.reserve (seed_indices_orig.size ());
417 float search_radius = 0.5f*seed_resolution_;
420 float min_points = 0.05f * (search_radius)*(search_radius) * 3.1415926536f / (resolution_*resolution_);
421 for (
size_t i = 0; i < seed_indices_orig.size (); ++i)
423 int num = voxel_kdtree_->
radiusSearch (seed_indices_orig[i], search_radius , neighbors, sqr_distances);
424 int min_index = seed_indices_orig[i];
425 if ( num > min_points)
427 seed_indices.push_back (min_index);
437 template <
typename Po
intT>
void 441 for (
typename HelperListT::iterator sv_itr = supervoxel_helpers_.begin (); sv_itr != supervoxel_helpers_.end (); ++sv_itr)
443 sv_itr->removeAllLeaves ();
446 std::vector<int> closest_index;
449 for (
typename HelperListT::iterator sv_itr = supervoxel_helpers_.begin (); sv_itr != supervoxel_helpers_.end (); ++sv_itr)
452 sv_itr->getXYZ (point.x, point.y, point.z);
453 voxel_kdtree_->
nearestKSearch (point, 1, closest_index, distance);
455 LeafContainerT* seed_leaf = adjacency_octree_->at (closest_index[0]);
458 sv_itr->addLeaf (seed_leaf);
462 PCL_WARN (
"Could not find leaf in pcl::SupervoxelClustering<PointT>::reseedSupervoxels - supervoxel will be deleted \n");
469 template <
typename Po
intT>
void 474 p.z = std::log (p.z);
478 template <
typename Po
intT>
float 482 float spatial_dist = (v1.
xyz_ - v2.
xyz_).norm () / seed_resolution_;
483 float color_dist = (v1.
rgb_ - v2.
rgb_).norm () / 255.0f;
484 float cos_angle_normal = 1.0f - std::abs (v1.
normal_.dot (v2.
normal_));
486 return cos_angle_normal * normal_importance_ + color_dist * color_importance_+ spatial_dist * spatial_importance_;
497 template <
typename Po
intT>
void 500 adjacency_list_arg.clear ();
502 std::map <uint32_t, VoxelID> label_ID_map;
503 for (
typename HelperListT::const_iterator sv_itr = supervoxel_helpers_.cbegin (); sv_itr != supervoxel_helpers_.cend (); ++sv_itr)
505 VoxelID node_id = add_vertex (adjacency_list_arg);
506 adjacency_list_arg[node_id] = (sv_itr->getLabel ());
507 label_ID_map.insert (std::make_pair (sv_itr->getLabel (), node_id));
510 for (
typename HelperListT::const_iterator sv_itr = supervoxel_helpers_.cbegin (); sv_itr != supervoxel_helpers_.cend (); ++sv_itr)
512 uint32_t label = sv_itr->getLabel ();
513 std::set<uint32_t> neighbor_labels;
514 sv_itr->getNeighborLabels (neighbor_labels);
515 for (std::set<uint32_t>::iterator label_itr = neighbor_labels.begin (); label_itr != neighbor_labels.end (); ++label_itr)
519 VoxelID u = (label_ID_map.find (label))->second;
520 VoxelID v = (label_ID_map.find (*label_itr))->second;
521 boost::tie (edge, edge_added) = add_edge (u,v,adjacency_list_arg);
525 VoxelData centroid_data = (sv_itr)->getCentroid ();
529 for (
typename HelperListT::const_iterator neighb_itr = supervoxel_helpers_.cbegin (); neighb_itr != supervoxel_helpers_.cend (); ++neighb_itr)
531 if (neighb_itr->getLabel () == (*label_itr))
533 neighb_centroid_data = neighb_itr->getCentroid ();
538 float length = voxelDataDistance (centroid_data, neighb_centroid_data);
539 adjacency_list_arg[edge] = length;
548 template <
typename Po
intT>
void 551 label_adjacency.clear ();
552 for (
typename HelperListT::const_iterator sv_itr = supervoxel_helpers_.cbegin (); sv_itr != supervoxel_helpers_.cend (); ++sv_itr)
554 uint32_t label = sv_itr->getLabel ();
555 std::set<uint32_t> neighbor_labels;
556 sv_itr->getNeighborLabels (neighbor_labels);
557 for (std::set<uint32_t>::iterator label_itr = neighbor_labels.begin (); label_itr != neighbor_labels.end (); ++label_itr)
558 label_adjacency.insert (std::pair<uint32_t,uint32_t> (label, *label_itr) );
570 return centroid_copy;
578 for (
typename HelperListT::const_iterator sv_itr = supervoxel_helpers_.cbegin (); sv_itr != supervoxel_helpers_.cend (); ++sv_itr)
581 sv_itr->getVoxels (voxels);
586 for ( ; xyzl_copy_itr != xyzl_copy.
end (); ++xyzl_copy_itr)
587 xyzl_copy_itr->label = sv_itr->getLabel ();
589 *labeled_voxel_cloud += xyzl_copy;
592 return labeled_voxel_cloud;
604 std::vector <int> indices;
605 std::vector <float> sqr_distances;
606 for (i_labeled = labeled_cloud->
begin (); i_labeled != labeled_cloud->
end (); ++i_labeled,++i_input)
608 if ( !pcl::isFinite<PointT> (*i_input))
609 i_labeled->label = 0;
612 i_labeled->label = 0;
613 LeafContainerT *leaf = adjacency_octree_->getLeafContainerAtPoint (*i_input);
614 VoxelData& voxel_data = leaf->getData ();
616 i_labeled->label = voxel_data.
owner_->getLabel ();
622 return (labeled_cloud);
630 normal_cloud->
resize (supervoxel_clusters.size ());
631 typename std::map <uint32_t, typename pcl::Supervoxel<PointT>::Ptr>::iterator sv_itr,sv_itr_end;
632 sv_itr = supervoxel_clusters.begin ();
633 sv_itr_end = supervoxel_clusters.end ();
635 for ( ; sv_itr != sv_itr_end; ++sv_itr, ++normal_cloud_itr)
637 (sv_itr->second)->getCentroidPointNormal (*normal_cloud_itr);
643 template <
typename Po
intT>
float 646 return (resolution_);
650 template <
typename Po
intT>
void 653 resolution_ = resolution;
658 template <
typename Po
intT>
float 661 return (seed_resolution_);
665 template <
typename Po
intT>
void 668 seed_resolution_ = seed_resolution;
673 template <
typename Po
intT>
void 676 color_importance_ = val;
680 template <
typename Po
intT>
void 683 spatial_importance_ = val;
687 template <
typename Po
intT>
void 690 normal_importance_ = val;
694 template <
typename Po
intT>
void 697 use_default_transform_behaviour_ =
false;
698 use_single_camera_transform_ = val;
702 template <
typename Po
intT>
int 706 for (
typename HelperListT::const_iterator sv_itr = supervoxel_helpers_.cbegin (); sv_itr != supervoxel_helpers_.cend (); ++sv_itr)
708 int temp = sv_itr->getLabel ();
709 if (temp > max_label)
757 template<
typename Po
intT>
void 761 point_arg.x = xyz_[0];
762 point_arg.y = xyz_[1];
763 point_arg.z = xyz_[2];
767 template <
typename Po
intT>
void 770 normal_arg.normal_x = normal_[0];
771 normal_arg.normal_y = normal_[1];
772 normal_arg.normal_z = normal_[2];
780 template <
typename Po
intT>
void 783 leaves_.insert (leaf_arg);
789 template <
typename Po
intT>
void 792 leaves_.erase (leaf_arg);
796 template <
typename Po
intT>
void 799 typename SupervoxelHelper::iterator leaf_itr;
800 for (leaf_itr = leaves_.begin (); leaf_itr != leaves_.end (); ++leaf_itr)
802 VoxelData& voxel = ((*leaf_itr)->getData ());
804 voxel.
distance_ = std::numeric_limits<float>::max ();
810 template <
typename Po
intT>
void 815 std::vector<LeafContainerT*> new_owned;
816 new_owned.reserve (leaves_.size () * 9);
818 typename SupervoxelHelper::iterator leaf_itr;
819 for (leaf_itr = leaves_.begin (); leaf_itr != leaves_.end (); ++leaf_itr)
825 VoxelData& neighbor_voxel = ((*neighb_itr)->getData ());
827 if(neighbor_voxel.
owner_ ==
this)
830 float dist = parent_->voxelDataDistance (centroid_, neighbor_voxel);
836 if (neighbor_voxel.
owner_ !=
this)
838 if (neighbor_voxel.
owner_)
839 (neighbor_voxel.
owner_)->removeLeaf(*neighb_itr);
840 neighbor_voxel.
owner_ =
this;
841 new_owned.push_back (*neighb_itr);
847 typename std::vector<LeafContainerT*>::iterator new_owned_itr;
848 for (new_owned_itr=new_owned.begin (); new_owned_itr!=new_owned.end (); ++new_owned_itr)
850 leaves_.insert (*new_owned_itr);
856 template <
typename Po
intT>
void 859 typename SupervoxelHelper::iterator leaf_itr;
861 for (leaf_itr = leaves_.begin (); leaf_itr != leaves_.end (); ++leaf_itr)
863 VoxelData& voxel_data = (*leaf_itr)->getData ();
864 std::vector<int> indices;
865 indices.reserve (81);
867 indices.push_back (voxel_data.
idx_);
871 VoxelData& neighbor_voxel_data = ((*neighb_itr)->getData ());
873 if (neighbor_voxel_data.
owner_ ==
this)
875 indices.push_back (neighbor_voxel_data.
idx_);
877 for (
typename LeafContainerT::const_iterator neighb_neighb_itr=(*neighb_itr)->cbegin (); neighb_neighb_itr!=(*neighb_itr)->cend (); ++neighb_neighb_itr)
879 VoxelData& neighb_neighb_voxel_data = (*neighb_neighb_itr)->getData ();
880 if (neighb_neighb_voxel_data.
owner_ ==
this)
881 indices.push_back (neighb_neighb_voxel_data.
idx_);
891 voxel_data.
normal_.normalize ();
896 template <
typename Po
intT>
void 899 centroid_.normal_ = Eigen::Vector4f::Zero ();
900 centroid_.xyz_ = Eigen::Vector3f::Zero ();
901 centroid_.rgb_ = Eigen::Vector3f::Zero ();
902 typename SupervoxelHelper::iterator leaf_itr = leaves_.begin ();
903 for ( ; leaf_itr!= leaves_.end (); ++leaf_itr)
905 const VoxelData& leaf_data = (*leaf_itr)->getData ();
907 centroid_.xyz_ += leaf_data.
xyz_;
908 centroid_.rgb_ += leaf_data.
rgb_;
910 centroid_.normal_.normalize ();
911 centroid_.xyz_ /=
static_cast<float> (leaves_.size ());
912 centroid_.rgb_ /=
static_cast<float> (leaves_.size ());
917 template <
typename Po
intT>
void 922 voxels->
resize (leaves_.size ());
924 typename SupervoxelHelper::const_iterator leaf_itr;
925 for ( leaf_itr = leaves_.begin (); leaf_itr != leaves_.end (); ++leaf_itr, ++voxel_itr)
927 const VoxelData& leaf_data = (*leaf_itr)->getData ();
933 template <
typename Po
intT>
void 938 normals->
resize (leaves_.size ());
939 typename SupervoxelHelper::const_iterator leaf_itr;
941 for (leaf_itr = leaves_.begin (); leaf_itr != leaves_.end (); ++leaf_itr, ++normal_itr)
943 const VoxelData& leaf_data = (*leaf_itr)->getData ();
949 template <
typename Po
intT>
void 952 neighbor_labels.clear ();
954 typename SupervoxelHelper::const_iterator leaf_itr;
955 for (leaf_itr = leaves_.begin (); leaf_itr != leaves_.end (); ++leaf_itr)
961 VoxelData& neighbor_voxel = ((*neighb_itr)->getData ());
963 if (neighbor_voxel.
owner_ !=
this && neighbor_voxel.
owner_)
965 neighbor_labels.insert (neighbor_voxel.
owner_->getLabel ());
972 #endif // PCL_SUPERVOXEL_CLUSTERING_HPP_ A point structure representing normal coordinates and the surface curvature estimate.
void setSeedResolution(float seed_resolution)
Set the resolution of the octree seed voxels.
void addPointsFromInputCloud()
Add points from input point cloud to octree.
Octree adjacency leaf container class- stores a list of pointers to neighbors, number of points added...
NeighborListT::const_iterator const_iterator
Octree pointcloud voxel class which maintains adjacency information for its voxels.
void setNormalImportance(float val)
Set the importance of scalar normal product for supervoxels.
void setColorImportance(float val)
Set the importance of color for supervoxels.
PCL_EXPORTS void copyPointCloud(const pcl::PCLPointCloud2 &cloud_in, const std::vector< int > &indices, pcl::PCLPointCloud2 &cloud_out)
Extract the indices of a given point cloud as a new point cloud.
int nearestKSearch(const PointT &point, int k, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances) const
Search for the k-nearest neighbors for the given query point.
int getMaxLabel() const
Returns the current maximum (highest) label.
VectorType::iterator iterator
pcl::PointCloud< pcl::PointXYZL >::Ptr getLabeledVoxelCloud() const
Returns labeled voxelized cloud Points that belong to the same supervoxel have the same label...
VoxelAdjacencyList::vertex_descriptor VoxelID
void setVoxelResolution(float resolution)
Set the resolution of the octree voxels.
void setInputCloud(const PointCloudConstPtr &cloud_arg, const IndicesConstPtr &indices_arg=IndicesConstPtr())
Provide a pointer to the input data set.
A point structure representing Euclidean xyz coordinates, and the RGBA color.
virtual void setInputCloud(const typename pcl::PointCloud< PointT >::ConstPtr &cloud)
This method sets the cloud to be supervoxelized.
bool computePointNormal(const pcl::PointCloud< PointT > &cloud, Eigen::Vector4f &plane_parameters, float &curvature)
Compute the Least-Squares plane fit for a given set of points, and return the estimated plane paramet...
friend class SupervoxelHelper
bool initCompute()
This method should get called before starting the actual computation.
SupervoxelClustering(float voxel_resolution, float seed_resolution)
Constructor that sets default values for member variables.
Supervoxel container class - stores a cluster extracted using supervoxel clustering.
boost::shared_ptr< PointCloud< PointT > > Ptr
void flipNormalTowardsViewpoint(const PointT &point, float vp_x, float vp_y, float vp_z, Eigen::Matrix< Scalar, 4, 1 > &normal)
Flip (in place) the estimated normal of a point towards a given viewpoint.
virtual void refineSupervoxels(int num_itr, std::map< uint32_t, typename Supervoxel< PointT >::Ptr > &supervoxel_clusters)
This method refines the calculated supervoxels - may only be called after extract.
virtual void setNormalCloud(typename NormalCloudT::ConstPtr normal_cloud)
This method sets the normals to be used for supervoxels (should be same size as input cloud) ...
pcl::PointCloud< PointXYZL >::Ptr getLabeledCloud() const
Returns labeled cloud Points that belong to the same supervoxel have the same label.
A point structure representing Euclidean xyz coordinates.
pcl::PointCloud< PointT >::Ptr getVoxelCentroidCloud() const
Returns a deep copy of the voxel centroid cloud.
void getNormal(Normal &normal_arg) const
Gets the data of in the form of a normal.
virtual void extract(std::map< uint32_t, typename Supervoxel< PointT >::Ptr > &supervoxel_clusters)
This method launches the segmentation algorithm and returns the supervoxels that were obtained during...
int radiusSearch(const PointT &point, double radius, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances, unsigned int max_nn=0) const
Search for all the nearest neighbors of the query point in a given radius.
void setUseSingleCameraTransform(bool val)
Set whether or not to use the single camera transform.
float distance(const PointT &p1, const PointT &p2)
VoxelData is a structure used for storing data within a pcl::octree::OctreePointCloudAdjacencyContain...
static pcl::PointCloud< pcl::PointNormal >::Ptr makeSupervoxelNormalCloud(std::map< uint32_t, typename Supervoxel< PointT >::Ptr > &supervoxel_clusters)
Static helper function which returns a pointcloud of normals for the input supervoxels.
boost::shared_ptr< const PointCloud< PointT > > ConstPtr
SupervoxelHelper * owner_
void clear()
Removes all points in a cloud and sets the width and height to 0.
bool deinitCompute()
This method should get called after finishing the actual computation.
PointCloud represents the base class in PCL for storing collections of 3D points. ...
Implements a supervoxel algorithm based on voxel structure, normals, and rgb values.
void setInputCloud(const PointCloudConstPtr &cloud, const IndicesConstPtr &indices=IndicesConstPtr())
Provide a pointer to the input dataset.
DataT & getData()
Returns a reference to the data member to access it without copying.
float getSeedResolution() const
Get the resolution of the octree seed voxels.
virtual ~SupervoxelClustering()
This destructor destroys the cloud, normals and search method used for finding neighbors.
Octree pointcloud search class
VoxelAdjacencyList::edge_descriptor EdgeID
void getPoint(PointT &point_arg) const
Gets the data of in the form of a point.
PointCloudConstPtr input_
The input point cloud dataset.
void resize(size_t n)
Resize the cloud.
void getSupervoxelAdjacencyList(VoxelAdjacencyList &adjacency_list_arg) const
Gets the adjacency list (Boost Graph library) which gives connections between supervoxels.
A point structure representing Euclidean xyz coordinates, and the RGB color.
boost::shared_ptr< Supervoxel< PointT > > Ptr
boost::adjacency_list< boost::setS, boost::setS, boost::undirectedS, uint32_t, float > VoxelAdjacencyList
int getOccupiedVoxelCenters(AlignedPointTVector &voxel_center_list_arg) const
Get a PointT vector of centers of all occupied voxels.
float getVoxelResolution() const
Get the resolution of the octree voxels.
void getSupervoxelAdjacency(std::multimap< uint32_t, uint32_t > &label_adjacency) const
Get a multimap which gives supervoxel adjacency.
VectorType::const_iterator const_iterator
void setSpatialImportance(float val)
Set the importance of spatial distance for supervoxels.