Point Cloud Library (PCL)
1.11.1-dev
|
41 #include <pcl/point_cloud.h>
42 #include <pcl/segmentation/supervoxel_clustering.h>
44 #define PCL_INSTANTIATE_LCCPSegmentation(T) template class PCL_EXPORTS pcl::LCCPSegmentation<T>;
56 template <
typename Po
intT>
63 float normal_difference;
72 bool used_for_cutting;
75 normal_difference (0), is_convex (
false), is_valid (
false), used_for_cutting (
false)
83 using SupervoxelAdjacencyList = boost::adjacency_list<boost::setS, boost::setS, boost::undirectedS, std::uint32_t, EdgeProperties>;
84 using VertexIterator =
typename boost::graph_traits<SupervoxelAdjacencyList>::vertex_iterator;
85 using AdjacencyIterator =
typename boost::graph_traits<SupervoxelAdjacencyList>::adjacency_iterator;
87 using VertexID =
typename boost::graph_traits<SupervoxelAdjacencyList>::vertex_descriptor;
88 using EdgeIterator =
typename boost::graph_traits<SupervoxelAdjacencyList>::edge_iterator;
89 using OutEdgeIterator =
typename boost::graph_traits<SupervoxelAdjacencyList>::out_edge_iterator;
90 using EdgeID =
typename boost::graph_traits<SupervoxelAdjacencyList>::edge_descriptor;
107 const std::multimap<std::uint32_t, std::uint32_t> &label_adjacency_arg)
135 PCL_WARN (
"[pcl::LCCPSegmentation::getSegmentMap] WARNING: Call function segment first. Nothing has been done. \n");
136 segment_supervoxel_map_arg = std::map<std::uint32_t, std::set<std::uint32_t> > ();
151 PCL_WARN (
"[pcl::LCCPSegmentation::getSegmentMap] WARNING: Call function segment first. Nothing has been done. \n");
152 supervoxel_segment_map_arg = std::map<std::uint32_t, std::uint32_t> ();
169 PCL_WARN (
"[pcl::LCCPSegmentation::getSegmentAdjacencyMap] WARNING: Call function segment first. Nothing has been done. \n");
170 segment_adjacency_map_arg = std::map<std::uint32_t, std::set<std::uint32_t> > ();
193 PCL_WARN (
"[pcl::LCCPSegmentation::getSVAdjacencyList] WARNING: Call function segment first. Nothing has been done. \n");
215 float smoothness_threshold_arg = 0.1)
262 const std::multimap<std::uint32_t, std::uint32_t> &label_adjacency_arg);
275 const unsigned int group_label);
294 const std::uint32_t target_label_arg,
295 float &normal_angle);
352 #ifdef PCL_NO_PRECOMPILE
353 #include <pcl/segmentation/impl/lccp_segmentation.hpp>
std::uint32_t min_segment_size_
Minimum segment size.
float getConcavityToleranceThreshold() const
Get normal threshold.
void setMinSegmentSize(const std::uint32_t min_segment_size_arg)
Set the value min_segment_size_ used in mergeSmallSegments.
typename boost::graph_traits< SupervoxelAdjacencyList >::vertex_iterator VertexIterator
typename boost::graph_traits< SupervoxelAdjacencyList >::vertex_descriptor VertexID
std::map< std::uint32_t, std::uint32_t > sv_label_to_seg_label_map_
Storing relation between original SuperVoxel Labels and new segmantion labels.
A simple segmentation algorithm partitioning a supervoxel graph into groups of locally convex connect...
bool supervoxels_set_
Marks if supervoxels have been set by calling setInputSupervoxels.
float smoothness_threshold_
Two supervoxels are unsmooth if their plane-to-plane distance DIST > (expected_distance + smoothness_...
void reset()
Reset internal memory.
void getSegmentToSupervoxelMap(std::map< std::uint32_t, std::set< std::uint32_t > > &segment_supervoxel_map_arg) const
Get map<SegmentID, std::set<SuperVoxel IDs> >
void setConcavityToleranceThreshold(float concavity_tolerance_threshold_arg)
Set normal threshold.
void mergeSmallSegments()
Segments smaller than min_segment_size_ are merged to the label of largest neighbor.
void recursiveSegmentGrowing(const VertexID &queryPointID, const unsigned int group_label)
Assigns neighbors of the query point to the same group as the query point.
void segment()
Merge supervoxels using local convexity.
PointCloud represents the base class in PCL for storing collections of 3D points.
float concavity_tolerance_threshold_
*** Parameters *** ///
std::map< std::uint32_t, std::set< std::uint32_t > > seg_label_to_neighbor_set_map_
map < SegmentID, std::set< Neighboring segment labels> >
std::map< std::uint32_t, std::set< std::uint32_t > > seg_label_to_sv_list_map_
map Segment Label to a set of Supervoxel Labels
void applyKconvexity(const unsigned int k_arg)
Connections are only convex if this is true for at least k_arg common neighbors of the two patches.
bool grouping_data_valid_
Marks if valid grouping data (sv_adjacency_list_, sv_label_to_seg_label_map_, processed_) is availabl...
void calculateConvexConnections(SupervoxelAdjacencyList &adjacency_list_arg)
Calculates convexity of edges and saves this to the adjacency graph.
SupervoxelAdjacencyList sv_adjacency_list_
Adjacency graph with the supervoxel labels as nodes and edges between adjacent supervoxels.
void setInputSupervoxels(const std::map< std::uint32_t, typename pcl::Supervoxel< PointT >::Ptr > &supervoxel_clusters_arg, const std::multimap< std::uint32_t, std::uint32_t > &label_adjacency_arg)
Set the supervoxel clusters as well as the adjacency graph for the segmentation.Those parameters are ...
void getSupervoxelToSegmentMap(std::map< std::uint32_t, std::uint32_t > &supervoxel_segment_map_arg) const
Get map<Supervoxel_ID, Segment_ID>
void computeSegmentAdjacency()
Compute the adjacency of the segments.
void doGrouping()
Perform depth search on the graph and recursively group all supervoxels with convex connections.
void relabelCloud(pcl::PointCloud< pcl::PointXYZL > &labeled_cloud_arg)
Relabels cloud with supervoxel labels with the computed segment labels.
typename boost::graph_traits< SupervoxelAdjacencyList >::adjacency_iterator AdjacencyIterator
typename boost::graph_traits< SupervoxelAdjacencyList >::out_edge_iterator OutEdgeIterator
bool use_smoothness_check_
Determines if the smoothness check is used during segmentation.
void setKFactor(const std::uint32_t k_factor_arg)
Set the value used for k convexity.
void getSVAdjacencyList(SupervoxelAdjacencyList &adjacency_list_arg) const
Get the supervoxel adjacency graph with classified edges (boost::adjacency_list).
bool use_sanity_check_
Determines if we use the sanity check which tries to find and invalidate singular connected patches.
shared_ptr< Supervoxel< PointT > > Ptr
std::map< std::uint32_t, typename pcl::Supervoxel< PointT >::Ptr > sv_label_to_supervoxel_map_
map from the supervoxel labels to the supervoxel objects
void prepareSegmentation(const std::map< std::uint32_t, typename pcl::Supervoxel< PointT >::Ptr > &supervoxel_clusters_arg, const std::multimap< std::uint32_t, std::uint32_t > &label_adjacency_arg)
Is called within setInputSupervoxels mainly to reserve required memory.
std::map< std::uint32_t, bool > processed_
Stores which supervoxel labels were already visited during recursive grouping.
float voxel_resolution_
Voxel resolution used to build the supervoxels (used only for smoothness check)
void getSegmentAdjacencyMap(std::map< std::uint32_t, std::set< std::uint32_t > > &segment_adjacency_map_arg)
Get map <SegmentID, std::set<Neighboring SegmentIDs> >
std::uint32_t k_factor_
Factor used for k-convexity.
bool connIsConvex(const std::uint32_t source_label_arg, const std::uint32_t target_label_arg, float &normal_angle)
Returns true if the connection between source and target is convex.
typename boost::graph_traits< SupervoxelAdjacencyList >::edge_iterator EdgeIterator
virtual ~LCCPSegmentation()
float seed_resolution_
Seed resolution of the supervoxels (used only for smoothness check)
void setSanityCheck(const bool use_sanity_criterion_arg)
Determines if we want to use the sanity criterion to invalidate singular connected patches.
typename boost::graph_traits< SupervoxelAdjacencyList >::edge_descriptor EdgeID
void setSmoothnessCheck(bool use_smoothness_check_arg, float voxel_res_arg, float seed_res_arg, float smoothness_threshold_arg=0.1)
Determines if a smoothness check is done during segmentation, trying to invalidate edges of non-smoot...
boost::adjacency_list< boost::setS, boost::setS, boost::undirectedS, std::uint32_t, EdgeProperties > SupervoxelAdjacencyList