42 #include <pcl/pcl_base.h>
44 #include <pcl/point_cloud.h>
46 #include <pcl/search/search.h>
49 #include <boost/graph/adjacency_list.hpp>
59 template <
typename Po
intT>
76 using Traits = boost::adjacency_list_traits< boost::vecS, boost::vecS, boost::directedS >;
78 using mGraph = boost::adjacency_list< boost::vecS, boost::vecS, boost::directedS,
79 boost::property< boost::vertex_name_t, std::string,
80 boost::property< boost::vertex_index_t, long,
81 boost::property< boost::vertex_color_t, boost::default_color_type,
82 boost::property< boost::vertex_distance_t, long,
83 boost::property< boost::vertex_predecessor_t, Traits::edge_descriptor > > > > >,
84 boost::property< boost::edge_capacity_t, double,
85 boost::property< boost::edge_residual_capacity_t, double,
86 boost::property< boost::edge_reverse_t, Traits::edge_descriptor > > > >;
88 using CapacityMap = boost::property_map< mGraph, boost::edge_capacity_t >::type;
90 using ReverseEdgeMap = boost::property_map< mGraph, boost::edge_reverse_t>::type;
102 using IndexMap = boost::property_map< mGraph, boost::vertex_index_t >::type;
131 setSigma (
double sigma);
141 setRadius (
double radius);
145 getSourceWeight ()
const;
151 setSourceWeight (
double weight);
157 getSearchMethod ()
const;
168 getNumberOfNeighbours ()
const;
174 setNumberOfNeighbours (
unsigned int neighbour_number);
177 std::vector<PointT, Eigen::aligned_allocator<PointT> >
178 getForegroundPoints ()
const;
187 std::vector<PointT, Eigen::aligned_allocator<PointT> >
188 getBackgroundPoints ()
const;
202 extract (std::vector <pcl::PointIndices>& clusters);
229 calculateUnaryPotential (
int point,
double& source_weight,
double& sink_weight)
const;
237 addEdge (
int source,
int target,
double weight);
245 calculateBinaryPotential (
int source,
int target)
const;
249 recalculateUnaryPotentials ();
253 recalculateBinaryPotentials ();
264 double inverse_sigma_{16.0};
267 bool binary_potentials_are_valid_{
false};
270 double epsilon_{0.0001};
273 double radius_{16.0};
276 bool unary_potentials_are_valid_{
false};
279 double source_weight_{0.8};
285 unsigned int number_of_neighbours_{14};
288 bool graph_is_valid_{
false};
291 std::vector<PointT, Eigen::aligned_allocator<PointT> > foreground_points_{};
294 std::vector<PointT, Eigen::aligned_allocator<PointT> > background_points_{};
297 std::vector <pcl::PointIndices> clusters_{};
303 std::shared_ptr<CapacityMap> capacity_{
nullptr};
306 std::shared_ptr<ReverseEdgeMap> reverse_edges_{
nullptr};
309 std::vector< VertexDescriptor > vertices_{};
312 std::vector< std::set<int> > edge_marker_{};
321 double max_flow_{0.0};
328 #ifdef PCL_NO_PRECOMPILE
329 #include <pcl/segmentation/impl/min_cut_segmentation.hpp>
shared_ptr< KdTree< PointT > > Ptr
This class implements the segmentation algorithm based on minimal cut of the graph.
boost::property_map< mGraph, boost::vertex_index_t >::type IndexMap
MinCutSegmentation()
Constructor that sets default values for member variables.
boost::graph_traits< mGraph >::out_edge_iterator OutEdgeIterator
boost::property_map< mGraph, boost::edge_capacity_t >::type CapacityMap
boost::property_map< mGraph, boost::edge_reverse_t >::type ReverseEdgeMap
shared_ptr< mGraph > mGraphPtr
Traits::vertex_descriptor VertexDescriptor
boost::graph_traits< mGraph >::vertex_iterator VertexIterator
typename KdTree::Ptr KdTreePtr
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
boost::graph_traits< mGraph >::edge_descriptor EdgeDescriptor
boost::graph_traits< mGraph >::in_edge_iterator InEdgeIterator
boost::property_map< mGraph, boost::edge_residual_capacity_t >::type ResidualCapacityMap
boost::adjacency_list_traits< boost::vecS, boost::vecS, boost::directedS > Traits
typename PointCloud::ConstPtr PointCloudConstPtr
PointCloud represents the base class in PCL for storing collections of 3D points.
shared_ptr< PointCloud< PointT > > Ptr
shared_ptr< const PointCloud< PointT > > ConstPtr
Defines all the PCL implemented PointT point type structures.
#define PCL_MAKE_ALIGNED_OPERATOR_NEW
Macro to signal a class requires a custom allocator.
Defines functions, macros and traits for allocating and using memory.
Defines all the PCL and non-PCL macros used.