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 ();
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.
std::shared_ptr< ReverseEdgeMap > reverse_edges_
Stores reverse edges for every edge in the graph.
double max_flow_
Stores the maximum flow value that was calculated during the segmentation.
double inverse_sigma_
Stores the sigma coefficient.
unsigned int number_of_neighbours_
Stores the number of neighbors to find.
double source_weight_
Stores the weight for every edge that comes from source point.
boost::property_map< mGraph, boost::vertex_index_t >::type IndexMap
std::vector< pcl::PointIndices > clusters_
After the segmentation it will contain the segments.
mGraphPtr graph_
Stores the graph for finding the maximum flow.
double epsilon_
Used for comparison of the floating point numbers.
std::vector< PointT, Eigen::aligned_allocator< PointT > > foreground_points_
Stores the points that are known to be in the foreground.
boost::graph_traits< mGraph >::out_edge_iterator OutEdgeIterator
VertexDescriptor sink_
Stores the vertex that serves as sink.
bool unary_potentials_are_valid_
Signalizes if the unary potentials are valid.
KdTreePtr search_
Stores the search method that will be used for finding K nearest neighbors.
std::shared_ptr< CapacityMap > capacity_
Stores the capacity of every edge in the graph.
boost::property_map< mGraph, boost::edge_capacity_t >::type CapacityMap
VertexDescriptor source_
Stores the vertex that serves as source.
bool graph_is_valid_
Signalizes if the graph is valid.
boost::property_map< mGraph, boost::edge_reverse_t >::type ReverseEdgeMap
shared_ptr< mGraph > mGraphPtr
Traits::vertex_descriptor VertexDescriptor
std::vector< VertexDescriptor > vertices_
Stores the vertices of the graph.
boost::graph_traits< mGraph >::vertex_iterator VertexIterator
std::vector< PointT, Eigen::aligned_allocator< PointT > > background_points_
Stores the points that are known to be in the background.
std::vector< std::set< int > > edge_marker_
Stores the information about the edges that were added to the graph.
typename KdTree::Ptr KdTreePtr
bool binary_potentials_are_valid_
Signalizes if the binary potentials are valid.
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
double radius_
Stores the distance to the background.
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.