Point Cloud Library (PCL)
1.8.1
|
A simple segmentation algorithm partitioning a supervoxel graph into groups of locally convex connected supervoxels separated by concave borders. More...
#include <pcl/segmentation/lccp_segmentation.h>
Public Types | |
typedef boost::adjacency_list< boost::setS, boost::setS, boost::undirectedS, uint32_t, EdgeProperties > | SupervoxelAdjacencyList |
typedef boost::graph_traits< SupervoxelAdjacencyList >::vertex_iterator | VertexIterator |
typedef boost::graph_traits< SupervoxelAdjacencyList >::adjacency_iterator | AdjacencyIterator |
typedef boost::graph_traits< SupervoxelAdjacencyList >::vertex_descriptor | VertexID |
typedef boost::graph_traits< SupervoxelAdjacencyList >::edge_iterator | EdgeIterator |
typedef boost::graph_traits< SupervoxelAdjacencyList >::out_edge_iterator | OutEdgeIterator |
typedef boost::graph_traits< SupervoxelAdjacencyList >::edge_descriptor | EdgeID |
Public Member Functions | |
LCCPSegmentation () | |
virtual | ~LCCPSegmentation () |
void | reset () |
Reset internal memory. More... | |
void | setInputSupervoxels (const std::map< uint32_t, typename pcl::Supervoxel< PointT >::Ptr > &supervoxel_clusters_arg, const std::multimap< uint32_t, uint32_t > &label_adjacency_arg) |
Set the supervoxel clusters as well as the adjacency graph for the segmentation.Those parameters are generated by using the SupervoxelClustering class. More... | |
void | segment () |
Merge supervoxels using local convexity. More... | |
void | relabelCloud (pcl::PointCloud< pcl::PointXYZL > &labeled_cloud_arg) |
Relabels cloud with supervoxel labels with the computed segment labels. More... | |
void | getSegmentToSupervoxelMap (std::map< uint32_t, std::set< uint32_t > > &segment_supervoxel_map_arg) const |
Get map<SegmentID, std::set<SuperVoxel IDs> > More... | |
void | getSupervoxelToSegmentMap (std::map< uint32_t, uint32_t > &supervoxel_segment_map_arg) const |
Get map<Supervoxel_ID, Segment_ID> More... | |
void | getSegmentAdjacencyMap (std::map< uint32_t, std::set< uint32_t > > &segment_adjacency_map_arg) |
Get map <SegmentID, std::set<Neighboring SegmentIDs> > More... | |
float | getConcavityToleranceThreshold () const |
Get normal threshold. More... | |
void | getSVAdjacencyList (SupervoxelAdjacencyList &adjacency_list_arg) const |
Get the supervoxel adjacency graph with classified edges (boost::adjacency_list). More... | |
void | setConcavityToleranceThreshold (float concavity_tolerance_threshold_arg) |
Set normal threshold. More... | |
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-smooth connected edges (steps). More... | |
void | setSanityCheck (const bool use_sanity_criterion_arg) |
Determines if we want to use the sanity criterion to invalidate singular connected patches. More... | |
void | setKFactor (const uint32_t k_factor_arg) |
Set the value used for k convexity. More... | |
void | setMinSegmentSize (const uint32_t min_segment_size_arg) |
Set the value min_segment_size_ used in mergeSmallSegments. More... | |
Protected Member Functions | |
void | mergeSmallSegments () |
Segments smaller than min_segment_size_ are merged to the label of largest neighbor. More... | |
void | computeSegmentAdjacency () |
Compute the adjacency of the segments. More... | |
void | prepareSegmentation (const std::map< uint32_t, typename pcl::Supervoxel< PointT >::Ptr > &supervoxel_clusters_arg, const std::multimap< uint32_t, uint32_t > &label_adjacency_arg) |
Is called within setInputSupervoxels mainly to reserve required memory. More... | |
void | doGrouping () |
Perform depth search on the graph and recursively group all supervoxels with convex connections. More... | |
void | recursiveSegmentGrowing (const VertexID &queryPointID, const unsigned int group_label) |
Assigns neighbors of the query point to the same group as the query point. More... | |
void | calculateConvexConnections (SupervoxelAdjacencyList &adjacency_list_arg) |
Calculates convexity of edges and saves this to the adjacency graph. More... | |
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. More... | |
bool | connIsConvex (const uint32_t source_label_arg, const uint32_t target_label_arg, float &normal_angle) |
Returns true if the connection between source and target is convex. More... | |
Protected Attributes | |
float | concavity_tolerance_threshold_ |
*** Parameters *** /// More... | |
bool | grouping_data_valid_ |
Marks if valid grouping data (sv_adjacency_list_, sv_label_to_seg_label_map_, processed_) is avaiable. More... | |
bool | supervoxels_set_ |
Marks if supervoxels have been set by calling setInputSupervoxels. More... | |
bool | use_smoothness_check_ |
Determines if the smoothness check is used during segmentation. More... | |
float | smoothness_threshold_ |
Two supervoxels are unsmooth if their plane-to-plane distance DIST > (expected_distance + smoothness_threshold_*voxel_resolution_). More... | |
bool | use_sanity_check_ |
Determines if we use the sanity check which tries to find and invalidate singular connected patches. More... | |
float | seed_resolution_ |
Seed resolution of the supervoxels (used only for smoothness check) More... | |
float | voxel_resolution_ |
Voxel resolution used to build the supervoxels (used only for smoothness check) More... | |
uint32_t | k_factor_ |
Factor used for k-convexity. More... | |
uint32_t | min_segment_size_ |
Minimum segment size. More... | |
std::map< uint32_t, bool > | processed_ |
Stores which supervoxel labels were already visited during recursive grouping. More... | |
SupervoxelAdjacencyList | sv_adjacency_list_ |
Adjacency graph with the supervoxel labels as nodes and edges between adjacent supervoxels. More... | |
std::map< uint32_t, typename pcl::Supervoxel< PointT >::Ptr > | sv_label_to_supervoxel_map_ |
map from the supervoxel labels to the supervoxel objects More... | |
std::map< uint32_t, uint32_t > | sv_label_to_seg_label_map_ |
Storing relation between original SuperVoxel Labels and new segmantion labels. More... | |
std::map< uint32_t, std::set< uint32_t > > | seg_label_to_sv_list_map_ |
map <Segment Label, std::set <SuperVoxel labels>=""> > More... | |
std::map< uint32_t, std::set< uint32_t > > | seg_label_to_neighbor_set_map_ |
map < SegmentID, std::set< Neighboring segment labels> > More... | |
A simple segmentation algorithm partitioning a supervoxel graph into groups of locally convex connected supervoxels separated by concave borders.
Definition at line 59 of file lccp_segmentation.h.
typedef boost::graph_traits<SupervoxelAdjacencyList>::adjacency_iterator pcl::LCCPSegmentation< PointT >::AdjacencyIterator |
Definition at line 87 of file lccp_segmentation.h.
typedef boost::graph_traits<SupervoxelAdjacencyList>::edge_descriptor pcl::LCCPSegmentation< PointT >::EdgeID |
Definition at line 92 of file lccp_segmentation.h.
typedef boost::graph_traits<SupervoxelAdjacencyList>::edge_iterator pcl::LCCPSegmentation< PointT >::EdgeIterator |
Definition at line 90 of file lccp_segmentation.h.
typedef boost::graph_traits<SupervoxelAdjacencyList>::out_edge_iterator pcl::LCCPSegmentation< PointT >::OutEdgeIterator |
Definition at line 91 of file lccp_segmentation.h.
typedef boost::adjacency_list<boost::setS, boost::setS, boost::undirectedS, uint32_t, EdgeProperties> pcl::LCCPSegmentation< PointT >::SupervoxelAdjacencyList |
Definition at line 85 of file lccp_segmentation.h.
typedef boost::graph_traits<SupervoxelAdjacencyList>::vertex_descriptor pcl::LCCPSegmentation< PointT >::VertexID |
Definition at line 89 of file lccp_segmentation.h.
typedef boost::graph_traits<SupervoxelAdjacencyList>::vertex_iterator pcl::LCCPSegmentation< PointT >::VertexIterator |
Definition at line 86 of file lccp_segmentation.h.
pcl::LCCPSegmentation< PointT >::LCCPSegmentation | ( | ) |
Definition at line 54 of file lccp_segmentation.hpp.
|
virtual |
Definition at line 69 of file lccp_segmentation.hpp.
|
protected |
Connections are only convex if this is true for at least k_arg common neighbors of the two patches.
Call setKFactor before segment to use this.
[in] | k_arg | Factor used for extended convexity check |
Definition at line 371 of file lccp_segmentation.hpp.
|
protected |
Calculates convexity of edges and saves this to the adjacency graph.
[in,out] | adjacency_list_arg | The supervoxel adjacency list |
Definition at line 437 of file lccp_segmentation.hpp.
|
protected |
Compute the adjacency of the segments.
Definition at line 138 of file lccp_segmentation.hpp.
Referenced by pcl::LCCPSegmentation< PointT >::getSegmentAdjacencyMap().
|
protected |
Returns true if the connection between source and target is convex.
[in] | source_label_arg | Label of one supervoxel connected to the edge that should be checked |
[in] | target_label_arg | Label of the other supervoxel connected to the edge that should be checked |
[out] | normal_angle | The angle between source and target |
Definition at line 460 of file lccp_segmentation.hpp.
References pcl::Supervoxel< PointT >::centroid_, pcl::getAngle3D(), and pcl::Supervoxel< PointT >::normal_.
|
protected |
Perform depth search on the graph and recursively group all supervoxels with convex connections.
Definition at line 308 of file lccp_segmentation.hpp.
|
inline |
Get normal threshold.
Definition at line 179 of file lccp_segmentation.h.
References pcl::LCCPSegmentation< PointT >::concavity_tolerance_threshold_.
|
inline |
Get map <SegmentID, std::set<Neighboring SegmentIDs> >
[out] | segment_adjacency_map_arg | map < SegmentID, std::set< Neighboring SegmentIDs> >. On error the map is empty. |
Definition at line 161 of file lccp_segmentation.h.
References pcl::LCCPSegmentation< PointT >::computeSegmentAdjacency(), pcl::LCCPSegmentation< PointT >::grouping_data_valid_, and pcl::LCCPSegmentation< PointT >::seg_label_to_neighbor_set_map_.
|
inline |
Get map<SegmentID, std::set<SuperVoxel IDs> >
[out] | segment_supervoxel_map_arg | The output container. On error the map is empty. |
Definition at line 129 of file lccp_segmentation.h.
References pcl::LCCPSegmentation< PointT >::grouping_data_valid_, and pcl::LCCPSegmentation< PointT >::seg_label_to_sv_list_map_.
|
inline |
Get map<Supervoxel_ID, Segment_ID>
[out] | supervoxel_segment_map_arg | The output container. On error the map is empty. |
Definition at line 145 of file lccp_segmentation.h.
References pcl::LCCPSegmentation< PointT >::grouping_data_valid_, and pcl::LCCPSegmentation< PointT >::sv_label_to_seg_label_map_.
|
inline |
Get the supervoxel adjacency graph with classified edges (boost::adjacency_list).
[out] | adjacency_list_arg | The supervoxel adjacency list with classified (convex/concave) edges. On error the list is empty. |
Definition at line 187 of file lccp_segmentation.h.
References pcl::LCCPSegmentation< PointT >::grouping_data_valid_, and pcl::LCCPSegmentation< PointT >::sv_adjacency_list_.
|
protected |
Segments smaller than min_segment_size_ are merged to the label of largest neighbor.
Definition at line 171 of file lccp_segmentation.hpp.
|
protected |
Is called within setInputSupervoxels mainly to reserve required memory.
[in] | supervoxel_clusters_arg | map of < supervoxel labels, supervoxels > |
[in] | label_adjacency_arg | The graph defining the supervoxel adjacency relations |
Definition at line 257 of file lccp_segmentation.hpp.
Referenced by pcl::LCCPSegmentation< PointT >::setInputSupervoxels().
|
protected |
Assigns neighbors of the query point to the same group as the query point.
Recursive part of doGrouping. Grouping is done by a depth-search of nodes in the adjacency-graph.
[in] | queryPointID | ID of point whose neighbors will be considered for grouping |
[in] | group_label | ID of the group/segment the queried point belongs to |
Definition at line 341 of file lccp_segmentation.hpp.
void pcl::LCCPSegmentation< PointT >::relabelCloud | ( | pcl::PointCloud< pcl::PointXYZL > & | labeled_cloud_arg | ) |
Relabels cloud with supervoxel labels with the computed segment labels.
labeled_cloud_arg should be created using the getLabeledCloud method of the SupervoxelClustering class.
[in,out] | labeled_cloud_arg | Cloud to relabel |
Definition at line 112 of file lccp_segmentation.hpp.
References pcl::PointCloud< PointT >::begin(), and pcl::PointCloud< PointT >::end().
void pcl::LCCPSegmentation< PointT >::reset | ( | ) |
Reset internal memory.
Definition at line 74 of file lccp_segmentation.hpp.
void pcl::LCCPSegmentation< PointT >::segment | ( | ) |
Merge supervoxels using local convexity.
The input parameters are generated by using the SupervoxelClustering class. To retrieve the output use the relabelCloud method.
Definition at line 87 of file lccp_segmentation.hpp.
|
inline |
Set normal threshold.
[in] | concavity_tolerance_threshold_arg | the concavity tolerance angle in [deg] to set |
Definition at line 203 of file lccp_segmentation.h.
References pcl::LCCPSegmentation< PointT >::concavity_tolerance_threshold_.
|
inline |
Set the supervoxel clusters as well as the adjacency graph for the segmentation.Those parameters are generated by using the SupervoxelClustering class.
To retrieve the output use the segment method.
[in] | supervoxel_clusters_arg | Map of < supervoxel labels, supervoxels > |
[in] | label_adjacency_arg | The graph defining the supervoxel adjacency relations |
Definition at line 108 of file lccp_segmentation.h.
References pcl::LCCPSegmentation< PointT >::prepareSegmentation(), and pcl::LCCPSegmentation< PointT >::supervoxels_set_.
|
inline |
Set the value used for k convexity.
For k>0 convex connections between p_i and p_j require k common neighbors of these patches that have a convex connection to both.
[in] | k_factor_arg | factor used for extended convexity check |
Definition at line 236 of file lccp_segmentation.h.
References pcl::LCCPSegmentation< PointT >::k_factor_.
|
inline |
Set the value min_segment_size_ used in mergeSmallSegments.
[in] | min_segment_size_arg | Segments smaller than this size will be merged |
Definition at line 244 of file lccp_segmentation.h.
References pcl::LCCPSegmentation< PointT >::min_segment_size_.
|
inline |
Determines if we want to use the sanity criterion to invalidate singular connected patches.
[in] | use_sanity_criterion_arg | Determines if the sanity check is performed |
Definition at line 228 of file lccp_segmentation.h.
References pcl::LCCPSegmentation< PointT >::use_sanity_check_.
|
inline |
Determines if a smoothness check is done during segmentation, trying to invalidate edges of non-smooth connected edges (steps).
Two supervoxels are unsmooth if their plane-to-plane distance DIST > (expected_distance + smoothness_threshold_*voxel_resolution_). For parallel supervoxels, the expected_distance is zero.
[in] | use_smoothness_check_arg | Determines if the smoothness check is used |
[in] | voxel_res_arg | The voxel resolution used for the supervoxels that are segmented |
[in] | seed_res_arg | The seed resolution used for the supervoxels that are segmented |
[in] | smoothness_threshold_arg | Threshold (/fudging factor) for smoothness constraint according to the above formula. |
Definition at line 214 of file lccp_segmentation.h.
References pcl::LCCPSegmentation< PointT >::seed_resolution_, pcl::LCCPSegmentation< PointT >::smoothness_threshold_, pcl::LCCPSegmentation< PointT >::use_smoothness_check_, and pcl::LCCPSegmentation< PointT >::voxel_resolution_.
|
protected |
*** Parameters *** ///
Normal Threshold in degrees [0,180] used for merging
Definition at line 302 of file lccp_segmentation.h.
Referenced by pcl::LCCPSegmentation< PointT >::getConcavityToleranceThreshold(), and pcl::LCCPSegmentation< PointT >::setConcavityToleranceThreshold().
|
protected |
Marks if valid grouping data (sv_adjacency_list_, sv_label_to_seg_label_map_, processed_) is avaiable.
Definition at line 305 of file lccp_segmentation.h.
Referenced by pcl::LCCPSegmentation< PointT >::getSegmentAdjacencyMap(), pcl::LCCPSegmentation< PointT >::getSegmentToSupervoxelMap(), pcl::LCCPSegmentation< PointT >::getSupervoxelToSegmentMap(), and pcl::LCCPSegmentation< PointT >::getSVAdjacencyList().
|
protected |
Factor used for k-convexity.
Definition at line 326 of file lccp_segmentation.h.
Referenced by pcl::LCCPSegmentation< PointT >::setKFactor().
|
protected |
Minimum segment size.
Definition at line 329 of file lccp_segmentation.h.
Referenced by pcl::LCCPSegmentation< PointT >::setMinSegmentSize().
|
protected |
Stores which supervoxel labels were already visited during recursive grouping.
Definition at line 333 of file lccp_segmentation.h.
|
protected |
Seed resolution of the supervoxels (used only for smoothness check)
Definition at line 320 of file lccp_segmentation.h.
Referenced by pcl::LCCPSegmentation< PointT >::setSmoothnessCheck().
|
protected |
map < SegmentID, std::set< Neighboring segment labels> >
Definition at line 349 of file lccp_segmentation.h.
Referenced by pcl::LCCPSegmentation< PointT >::getSegmentAdjacencyMap().
|
protected |
map <Segment Label, std::set <SuperVoxel labels>=""> >
Definition at line 346 of file lccp_segmentation.h.
Referenced by pcl::LCCPSegmentation< PointT >::getSegmentToSupervoxelMap().
|
protected |
Two supervoxels are unsmooth if their plane-to-plane distance DIST > (expected_distance + smoothness_threshold_*voxel_resolution_).
For parallel supervoxels, the expected_distance is zero.
Definition at line 314 of file lccp_segmentation.h.
Referenced by pcl::LCCPSegmentation< PointT >::setSmoothnessCheck().
|
protected |
Marks if supervoxels have been set by calling setInputSupervoxels.
Definition at line 308 of file lccp_segmentation.h.
Referenced by pcl::LCCPSegmentation< PointT >::setInputSupervoxels().
|
protected |
Adjacency graph with the supervoxel labels as nodes and edges between adjacent supervoxels.
Definition at line 336 of file lccp_segmentation.h.
Referenced by pcl::LCCPSegmentation< PointT >::getSVAdjacencyList().
|
protected |
Storing relation between original SuperVoxel Labels and new segmantion labels.
Definition at line 343 of file lccp_segmentation.h.
Referenced by pcl::LCCPSegmentation< PointT >::getSupervoxelToSegmentMap().
|
protected |
map from the supervoxel labels to the supervoxel objects
Definition at line 339 of file lccp_segmentation.h.
|
protected |
Determines if we use the sanity check which tries to find and invalidate singular connected patches.
Definition at line 317 of file lccp_segmentation.h.
Referenced by pcl::LCCPSegmentation< PointT >::setSanityCheck().
|
protected |
Determines if the smoothness check is used during segmentation.
Definition at line 311 of file lccp_segmentation.h.
Referenced by pcl::LCCPSegmentation< PointT >::setSmoothnessCheck().
|
protected |
Voxel resolution used to build the supervoxels (used only for smoothness check)
Definition at line 323 of file lccp_segmentation.h.
Referenced by pcl::LCCPSegmentation< PointT >::setSmoothnessCheck().