41 #include <pcl/segmentation/boost.h> 43 #include <pcl/pcl_base.h> 45 #include <pcl/point_cloud.h> 47 #include <pcl/search/search.h> 58 template <
typename Po
intT>
75 using Traits = boost::adjacency_list_traits< boost::vecS, boost::vecS, boost::directedS >;
77 using mGraph = boost::adjacency_list< boost::vecS, boost::vecS, boost::directedS,
78 boost::property< boost::vertex_name_t, std::string,
79 boost::property< boost::vertex_index_t, long,
80 boost::property< boost::vertex_color_t, boost::default_color_type,
81 boost::property< boost::vertex_distance_t, long,
82 boost::property< boost::vertex_predecessor_t, Traits::edge_descriptor > > > > >,
83 boost::property< boost::edge_capacity_t, double,
84 boost::property< boost::edge_residual_capacity_t, double,
85 boost::property< boost::edge_reverse_t, Traits::edge_descriptor > > > >;
87 using CapacityMap = boost::property_map< mGraph, boost::edge_capacity_t >::type;
89 using ReverseEdgeMap = boost::property_map< mGraph, boost::edge_reverse_t>::type;
101 using IndexMap = boost::property_map< mGraph, boost::vertex_index_t >::type;
130 setSigma (
double sigma);
140 setRadius (
double radius);
144 getSourceWeight ()
const;
150 setSourceWeight (
double weight);
156 getSearchMethod ()
const;
167 getNumberOfNeighbours ()
const;
173 setNumberOfNeighbours (
unsigned int neighbour_number);
176 std::vector<PointT, Eigen::aligned_allocator<PointT> >
177 getForegroundPoints ()
const;
186 std::vector<PointT, Eigen::aligned_allocator<PointT> >
187 getBackgroundPoints ()
const;
201 extract (std::vector <pcl::PointIndices>& clusters);
228 calculateUnaryPotential (
int point,
double& source_weight,
double& sink_weight)
const;
236 addEdge (
int source,
int target,
double weight);
244 calculateBinaryPotential (
int source,
int target)
const;
248 recalculateUnaryPotentials ();
252 recalculateBinaryPotentials ();
327 #ifdef PCL_NO_PRECOMPILE 328 #include <pcl/segmentation/impl/min_cut_segmentation.hpp> typename KdTree::Ptr KdTreePtr
shared_ptr< PointCloud< PointT > > Ptr
Defines functions, macros and traits for allocating and using memory.
KdTreePtr search_
Stores the search method that will be used for finding K nearest neighbors.
bool unary_potentials_are_valid_
Signalizes if the unary potentials are valid.
boost::graph_traits< mGraph >::out_edge_iterator OutEdgeIterator
std::vector< std::set< int > > edge_marker_
Stores the information about the edges that were added to the graph.
boost::property_map< mGraph, boost::edge_capacity_t >::type CapacityMap
double radius_
Stores the distance to the background.
boost::graph_traits< mGraph >::edge_descriptor EdgeDescriptor
unsigned int number_of_neighbours_
Stores the number of neighbors to find.
std::vector< PointT, Eigen::aligned_allocator< PointT > > foreground_points_
Stores the points that are known to be in the foreground.
boost::graph_traits< mGraph >::in_edge_iterator InEdgeIterator
Traits::vertex_descriptor VertexDescriptor
#define PCL_MAKE_ALIGNED_OPERATOR_NEW
Macro to signal a class requires a custom allocator.
VertexDescriptor sink_
Stores the vertex that serves as sink.
shared_ptr< KdTree< PointT > > Ptr
shared_ptr< mGraph > mGraphPtr
double epsilon_
Used for comparison of the floating point numbers.
std::vector< pcl::PointIndices > clusters_
After the segmentation it will contain the segments.
This class implements the segmentation algorithm based on minimal cut of the graph.
Defines all the PCL implemented PointT point type structures.
mGraphPtr graph_
Stores the graph for finding the maximum flow.
boost::adjacency_list_traits< boost::vecS, boost::vecS, boost::directedS > Traits
bool binary_potentials_are_valid_
Signalizes if the binary potentials are valid.
boost::property_map< mGraph, boost::edge_reverse_t >::type ReverseEdgeMap
boost::property_map< mGraph, boost::edge_residual_capacity_t >::type ResidualCapacityMap
std::vector< VertexDescriptor > vertices_
Stores the vertices of the graph.
PointCloud represents the base class in PCL for storing collections of 3D points. ...
bool graph_is_valid_
Signalizes if the graph is valid.
std::vector< PointT, Eigen::aligned_allocator< PointT > > background_points_
Stores the points that are known to be in the background.
boost::property_map< mGraph, boost::vertex_index_t >::type IndexMap
VertexDescriptor source_
Stores the vertex that serves as source.
boost::graph_traits< mGraph >::vertex_iterator VertexIterator
shared_ptr< const PointCloud< PointT > > ConstPtr
double inverse_sigma_
Stores the sigma coefficient.
std::shared_ptr< ReverseEdgeMap > reverse_edges_
Stores reverse edges for every edge in the graph.
std::shared_ptr< CapacityMap > capacity_
Stores the capacity of every edge in the graph.
boost::adjacency_list< boost::vecS, boost::vecS, boost::directedS, boost::property< boost::vertex_name_t, std::string, boost::property< boost::vertex_index_t, long, boost::property< boost::vertex_color_t, boost::default_color_type, boost::property< boost::vertex_distance_t, long, boost::property< boost::vertex_predecessor_t, Traits::edge_descriptor > > > > >, boost::property< boost::edge_capacity_t, double, boost::property< boost::edge_residual_capacity_t, double, boost::property< boost::edge_reverse_t, Traits::edge_descriptor > > > > mGraph
double max_flow_
Stores the maximum flow value that was calculated during the segmentation.
Defines all the PCL and non-PCL macros used.
double source_weight_
Stores the weight for every edge that comes from source point.
typename PointCloud::ConstPtr PointCloudConstPtr