Point Cloud Library (PCL)
1.14.1-dev
|
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 | |
using | SupervoxelAdjacencyList = boost::adjacency_list< boost::setS, boost::setS, boost::undirectedS, std::uint32_t, EdgeProperties > |
using | VertexIterator = typename boost::graph_traits< SupervoxelAdjacencyList >::vertex_iterator |
using | AdjacencyIterator = typename boost::graph_traits< SupervoxelAdjacencyList >::adjacency_iterator |
using | VertexID = typename boost::graph_traits< SupervoxelAdjacencyList >::vertex_descriptor |
using | EdgeIterator = typename boost::graph_traits< SupervoxelAdjacencyList >::edge_iterator |
using | OutEdgeIterator = typename boost::graph_traits< SupervoxelAdjacencyList >::out_edge_iterator |
using | EdgeID = typename boost::graph_traits< SupervoxelAdjacencyList >::edge_descriptor |
Public Member Functions | |
LCCPSegmentation () | |
virtual | ~LCCPSegmentation () |
void | reset () |
Reset internal memory. More... | |
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 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< std::uint32_t, std::set< std::uint32_t > > &segment_supervoxel_map_arg) const |
Get map<SegmentID, std::set<SuperVoxel IDs> > More... | |
void | getSupervoxelToSegmentMap (std::map< std::uint32_t, std::uint32_t > &supervoxel_segment_map_arg) const |
Get map<Supervoxel_ID, Segment_ID> More... | |
void | getSegmentAdjacencyMap (std::map< std::uint32_t, std::set< std::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 std::uint32_t k_factor_arg) |
Set the value used for k convexity. More... | |
void | setMinSegmentSize (const std::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< 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. 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 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. More... | |
Protected Attributes | |
float | concavity_tolerance_threshold_ {10} |
*** Parameters *** /// More... | |
bool | grouping_data_valid_ {false} |
Marks if valid grouping data (sv_adjacency_list_, sv_label_to_seg_label_map_, processed_) is available. More... | |
bool | supervoxels_set_ {false} |
Marks if supervoxels have been set by calling setInputSupervoxels. More... | |
bool | use_smoothness_check_ {false} |
Determines if the smoothness check is used during segmentation. More... | |
float | smoothness_threshold_ {0.1} |
Two supervoxels are unsmooth if their plane-to-plane distance DIST > (expected_distance + smoothness_threshold_*voxel_resolution_). More... | |
bool | use_sanity_check_ {false} |
Determines if we use the sanity check which tries to find and invalidate singular connected patches. More... | |
float | seed_resolution_ {0.0f} |
Seed resolution of the supervoxels (used only for smoothness check) More... | |
float | voxel_resolution_ {0.0f} |
Voxel resolution used to build the supervoxels (used only for smoothness check) More... | |
std::uint32_t | k_factor_ {0} |
Factor used for k-convexity. More... | |
std::uint32_t | min_segment_size_ {0} |
Minimum segment size. More... | |
std::map< std::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< std::uint32_t, typename pcl::Supervoxel< PointT >::Ptr > | sv_label_to_supervoxel_map_ |
map from the supervoxel labels to the supervoxel objects More... | |
std::map< std::uint32_t, std::uint32_t > | sv_label_to_seg_label_map_ |
Storing relation between original SuperVoxel Labels and new segmantion labels. More... | |
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 More... | |
std::map< std::uint32_t, std::set< std::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 57 of file lccp_segmentation.h.
using pcl::LCCPSegmentation< PointT >::AdjacencyIterator = typename boost::graph_traits<SupervoxelAdjacencyList>::adjacency_iterator |
Definition at line 82 of file lccp_segmentation.h.
using pcl::LCCPSegmentation< PointT >::EdgeID = typename boost::graph_traits<SupervoxelAdjacencyList>::edge_descriptor |
Definition at line 87 of file lccp_segmentation.h.
using pcl::LCCPSegmentation< PointT >::EdgeIterator = typename boost::graph_traits<SupervoxelAdjacencyList>::edge_iterator |
Definition at line 85 of file lccp_segmentation.h.
using pcl::LCCPSegmentation< PointT >::OutEdgeIterator = typename boost::graph_traits<SupervoxelAdjacencyList>::out_edge_iterator |
Definition at line 86 of file lccp_segmentation.h.
using pcl::LCCPSegmentation< PointT >::SupervoxelAdjacencyList = boost::adjacency_list<boost::setS, boost::setS, boost::undirectedS, std::uint32_t, EdgeProperties> |
Definition at line 80 of file lccp_segmentation.h.
using pcl::LCCPSegmentation< PointT >::VertexID = typename boost::graph_traits<SupervoxelAdjacencyList>::vertex_descriptor |
Definition at line 84 of file lccp_segmentation.h.
using pcl::LCCPSegmentation< PointT >::VertexIterator = typename boost::graph_traits<SupervoxelAdjacencyList>::vertex_iterator |
Definition at line 81 of file lccp_segmentation.h.
|
default |
|
virtualdefault |
|
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 339 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 396 of file lccp_segmentation.hpp.
|
protected |
Compute the adjacency of the segments.
Definition at line 123 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 416 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 278 of file lccp_segmentation.hpp.
|
inline |
Get normal threshold.
Definition at line 174 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 156 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 124 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 140 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 182 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 154 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 228 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 309 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 SupervoxelClustering::getLabeledCloud.
[in,out] | labeled_cloud_arg | Cloud to relabel |
Definition at line 98 of file lccp_segmentation.hpp.
void pcl::LCCPSegmentation< PointT >::reset |
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 73 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 198 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 103 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 231 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 239 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 223 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 209 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 297 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 available.
Definition at line 300 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 321 of file lccp_segmentation.h.
Referenced by pcl::LCCPSegmentation< PointT >::setKFactor().
|
protected |
Minimum segment size.
Definition at line 324 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 328 of file lccp_segmentation.h.
|
protected |
Seed resolution of the supervoxels (used only for smoothness check)
Definition at line 315 of file lccp_segmentation.h.
Referenced by pcl::LCCPSegmentation< PointT >::setSmoothnessCheck().
|
protected |
map < SegmentID, std::set< Neighboring segment labels> >
Definition at line 344 of file lccp_segmentation.h.
Referenced by pcl::LCCPSegmentation< PointT >::getSegmentAdjacencyMap().
|
protected |
map Segment Label to a set of Supervoxel Labels
Definition at line 341 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 309 of file lccp_segmentation.h.
Referenced by pcl::LCCPSegmentation< PointT >::setSmoothnessCheck().
|
protected |
Marks if supervoxels have been set by calling setInputSupervoxels.
Definition at line 303 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 331 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 338 of file lccp_segmentation.h.
Referenced by pcl::LCCPSegmentation< PointT >::getSupervoxelToSegmentMap().
|
protected |
map from the supervoxel labels to the supervoxel objects
Definition at line 334 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 312 of file lccp_segmentation.h.
Referenced by pcl::LCCPSegmentation< PointT >::setSanityCheck().
|
protected |
Determines if the smoothness check is used during segmentation.
Definition at line 306 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 318 of file lccp_segmentation.h.
Referenced by pcl::LCCPSegmentation< PointT >::setSmoothnessCheck().