38 #ifndef PCL_SEGMENTATION_LCCP_SEGMENTATION_H_ 39 #define PCL_SEGMENTATION_LCCP_SEGMENTATION_H_ 41 #include <pcl/pcl_base.h> 43 #include <pcl/point_cloud.h> 44 #include <pcl/segmentation/supervoxel_clustering.h> 46 #define PCL_INSTANTIATE_LCCPSegmentation(T) template class PCL_EXPORTS pcl::LCCPSegmentation<T>; 58 template <
typename Po
intT>
65 float normal_difference;
74 bool used_for_cutting;
77 normal_difference (0), is_convex (
false), is_valid (
false), used_for_cutting (
false)
85 typedef typename boost::adjacency_list<boost::setS, boost::setS, boost::undirectedS, uint32_t, EdgeProperties>
SupervoxelAdjacencyList;
86 typedef typename boost::graph_traits<SupervoxelAdjacencyList>::vertex_iterator
VertexIterator;
87 typedef typename boost::graph_traits<SupervoxelAdjacencyList>::adjacency_iterator
AdjacencyIterator;
89 typedef typename boost::graph_traits<SupervoxelAdjacencyList>::vertex_descriptor
VertexID;
90 typedef typename boost::graph_traits<SupervoxelAdjacencyList>::edge_iterator
EdgeIterator;
91 typedef typename boost::graph_traits<SupervoxelAdjacencyList>::out_edge_iterator
OutEdgeIterator;
92 typedef typename boost::graph_traits<SupervoxelAdjacencyList>::edge_descriptor
EdgeID;
109 const std::multimap<uint32_t, uint32_t> &label_adjacency_arg)
137 PCL_WARN (
"[pcl::LCCPSegmentation::getSegmentMap] WARNING: Call function segment first. Nothing has been done. \n");
138 segment_supervoxel_map_arg = std::map<uint32_t, std::set<uint32_t> > ();
153 PCL_WARN (
"[pcl::LCCPSegmentation::getSegmentMap] WARNING: Call function segment first. Nothing has been done. \n");
154 supervoxel_segment_map_arg = std::map<uint32_t, uint32_t> ();
171 PCL_WARN (
"[pcl::LCCPSegmentation::getSegmentAdjacencyMap] WARNING: Call function segment first. Nothing has been done. \n");
172 segment_adjacency_map_arg = std::map<uint32_t, std::set<uint32_t> > ();
195 PCL_WARN (
"[pcl::LCCPSegmentation::getSVAdjacencyList] WARNING: Call function segment first. Nothing has been done. \n");
217 float smoothness_threshold_arg = 0.1)
264 const std::multimap<uint32_t, uint32_t> &label_adjacency_arg);
277 const unsigned int group_label);
296 const uint32_t target_label_arg,
297 float &normal_angle);
354 #ifdef PCL_NO_PRECOMPILE 355 #include <pcl/segmentation/impl/lccp_segmentation.hpp> 358 #endif // PCL_SEGMENTATION_LCCP_SEGMENTATION_H_ std::map< uint32_t, bool > processed_
Stores which supervoxel labels were already visited during recursive grouping.
bool use_smoothness_check_
Determines if the smoothness check is used during segmentation.
std::map< uint32_t, std::set< uint32_t > > seg_label_to_neighbor_set_map_
map < SegmentID, std::set< Neighboring segment labels> >
A simple segmentation algorithm partitioning a supervoxel graph into groups of locally convex connect...
void doGrouping()
Perform depth search on the graph and recursively group all supervoxels with convex connections.
void computeSegmentAdjacency()
Compute the adjacency of the segments.
void relabelCloud(pcl::PointCloud< pcl::PointXYZL > &labeled_cloud_arg)
Relabels cloud with supervoxel labels with the computed segment labels.
bool use_sanity_check_
Determines if we use the sanity check which tries to find and invalidate singular connected patches.
boost::graph_traits< SupervoxelAdjacencyList >::vertex_iterator VertexIterator
void getSVAdjacencyList(SupervoxelAdjacencyList &adjacency_list_arg) const
Get the supervoxel adjacency graph with classified edges (boost::adjacency_list).
float voxel_resolution_
Voxel resolution used to build the supervoxels (used only for smoothness check)
uint32_t min_segment_size_
Minimum segment size.
uint32_t k_factor_
Factor used for k-convexity.
std::map< uint32_t, std::set< uint32_t > > seg_label_to_sv_list_map_
map <Segment Label, std::set <SuperVoxel labels>=""> >
void getSupervoxelToSegmentMap(std::map< uint32_t, uint32_t > &supervoxel_segment_map_arg) const
Get map<Supervoxel_ID, Segment_ID>
std::map< 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< 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.
void setMinSegmentSize(const uint32_t min_segment_size_arg)
Set the value min_segment_size_ used in mergeSmallSegments.
virtual ~LCCPSegmentation()
float seed_resolution_
Seed resolution of the supervoxels (used only for smoothness check)
void getSegmentAdjacencyMap(std::map< uint32_t, std::set< uint32_t > > &segment_adjacency_map_arg)
Get map <SegmentID, std::set<Neighboring SegmentIDs> >
boost::adjacency_list< boost::setS, boost::setS, boost::undirectedS, uint32_t, EdgeProperties > SupervoxelAdjacencyList
Defines all the PCL implemented PointT point type structures.
float getConcavityToleranceThreshold() const
Get normal threshold.
void setSanityCheck(const bool use_sanity_criterion_arg)
Determines if we want to use the sanity criterion to invalidate singular connected patches.
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...
void getSegmentToSupervoxelMap(std::map< uint32_t, std::set< uint32_t > > &segment_supervoxel_map_arg) const
Get map<SegmentID, std::set<SuperVoxel IDs> >
boost::graph_traits< SupervoxelAdjacencyList >::edge_iterator EdgeIterator
float smoothness_threshold_
Two supervoxels are unsmooth if their plane-to-plane distance DIST > (expected_distance + smoothness_...
void reset()
Reset internal memory.
boost::graph_traits< SupervoxelAdjacencyList >::adjacency_iterator AdjacencyIterator
bool supervoxels_set_
Marks if supervoxels have been set by calling setInputSupervoxels.
boost::graph_traits< SupervoxelAdjacencyList >::vertex_descriptor VertexID
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 ...
void mergeSmallSegments()
Segments smaller than min_segment_size_ are merged to the label of largest neighbor.
PointCloud represents the base class in PCL for storing collections of 3D points.
void setConcavityToleranceThreshold(float concavity_tolerance_threshold_arg)
Set normal threshold.
boost::graph_traits< SupervoxelAdjacencyList >::edge_descriptor EdgeID
void segment()
Merge supervoxels using local convexity.
void setKFactor(const uint32_t k_factor_arg)
Set the value used for k convexity.
void recursiveSegmentGrowing(const VertexID &queryPointID, const unsigned int group_label)
Assigns neighbors of the query point to the same group as the query point.
boost::graph_traits< SupervoxelAdjacencyList >::out_edge_iterator OutEdgeIterator
std::map< uint32_t, uint32_t > sv_label_to_seg_label_map_
Storing relation between original SuperVoxel Labels and new segmantion labels.
boost::shared_ptr< Supervoxel< PointT > > Ptr
float concavity_tolerance_threshold_
*** Parameters *** ///
void calculateConvexConnections(SupervoxelAdjacencyList &adjacency_list_arg)
Calculates convexity of edges and saves this to the adjacency graph.
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 avaiable...
SupervoxelAdjacencyList sv_adjacency_list_
Adjacency graph with the supervoxel labels as nodes and edges between adjacent supervoxels.
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.