This class implements the segmentation algorithm based on minimal cut of the graph. More...
#include <pcl/segmentation/min_cut_segmentation.h>
Public Types | |
using | KdTree = pcl::search::Search< PointT > |
using | KdTreePtr = typename KdTree::Ptr |
using | PointCloud = pcl::PointCloud< PointT > |
using | PointCloudConstPtr = typename PointCloud::ConstPtr |
using | Traits = boost::adjacency_list_traits< boost::vecS, boost::vecS, boost::directedS > |
using | mGraph = 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 > > > > |
using | CapacityMap = boost::property_map< mGraph, boost::edge_capacity_t >::type |
using | ReverseEdgeMap = boost::property_map< mGraph, boost::edge_reverse_t >::type |
using | VertexDescriptor = Traits::vertex_descriptor |
using | EdgeDescriptor = boost::graph_traits< mGraph >::edge_descriptor |
using | OutEdgeIterator = boost::graph_traits< mGraph >::out_edge_iterator |
using | VertexIterator = boost::graph_traits< mGraph >::vertex_iterator |
using | ResidualCapacityMap = boost::property_map< mGraph, boost::edge_residual_capacity_t >::type |
using | IndexMap = boost::property_map< mGraph, boost::vertex_index_t >::type |
using | InEdgeIterator = boost::graph_traits< mGraph >::in_edge_iterator |
using | mGraphPtr = shared_ptr< mGraph > |
Public Types inherited from pcl::PCLBase< PointT > | |
using | PointCloud = pcl::PointCloud< PointT > |
using | PointCloudPtr = typename PointCloud::Ptr |
using | PointCloudConstPtr = typename PointCloud::ConstPtr |
using | PointIndicesPtr = PointIndices::Ptr |
using | PointIndicesConstPtr = PointIndices::ConstPtr |
Public Member Functions | |
MinCutSegmentation () | |
Constructor that sets default values for member variables. More... |
|
~MinCutSegmentation () | |
Destructor that frees memory. More... |
|
void | setInputCloud (const PointCloudConstPtr &cloud) override |
This method simply sets the input point cloud. More... |
|
double | getSigma () const |
Returns normalization value for binary potentials. More... |
|
void | setSigma (double sigma) |
Allows to set the normalization value for the binary potentials as described in the article. More... |
|
double | getRadius () const |
Returns radius to the background. More... |
|
void | setRadius (double radius) |
Allows to set the radius to the background. More... |
|
double | getSourceWeight () const |
Returns weight that every edge from the source point has. More... |
|
void | setSourceWeight (double weight) |
Allows to set weight for source edges. More... |
|
KdTreePtr | getSearchMethod () const |
Returns search method that is used for finding KNN. More... |
|
void | setSearchMethod (const KdTreePtr &tree) |
Allows to set search method for finding KNN. More... |
|
unsigned int | getNumberOfNeighbours () const |
Returns the number of neighbours to find. More... |
|
void | setNumberOfNeighbours (unsigned int neighbour_number) |
Allows to set the number of neighbours to find. More... |
|
std::vector< PointT, Eigen::aligned_allocator< PointT > > | getForegroundPoints () const |
Returns the points that must belong to foreground. More... |
|
void | setForegroundPoints (typename pcl::PointCloud< PointT >::Ptr foreground_points) |
Allows to specify points which are known to be the points of the object. More... |
|
std::vector< PointT, Eigen::aligned_allocator< PointT > > | getBackgroundPoints () const |
Returns the points that must belong to background. More... |
|
void | setBackgroundPoints (typename pcl::PointCloud< PointT >::Ptr background_points) |
Allows to specify points which are known to be the points of the background. More... |
|
void | extract (std::vector< pcl::PointIndices > &clusters) |
This method launches the segmentation algorithm and returns the clusters that were obtained during the segmentation. More... |
|
double | getMaxFlow () const |
Returns that flow value that was calculated during the segmentation. More... |
|
mGraphPtr | getGraph () const |
Returns the graph that was build for finding the minimum cut. More... |
|
pcl::PointCloud< pcl::PointXYZRGB >::Ptr | getColoredCloud () |
Returns the colored cloud. More... |
|
Public Member Functions inherited from pcl::PCLBase< PointT > | |
PCLBase () | |
Empty constructor. More... |
|
PCLBase (const PCLBase &base) | |
Copy constructor. More... |
|
virtual | ~PCLBase ()=default |
Destructor. More... |
|
const PointCloudConstPtr | getInputCloud () const |
Get a pointer to the input point cloud dataset. More... |
|
virtual void | setIndices (const IndicesPtr &indices) |
Provide a pointer to the vector of indices that represents the input data. More... |
|
virtual void | setIndices (const IndicesConstPtr &indices) |
Provide a pointer to the vector of indices that represents the input data. More... |
|
virtual void | setIndices (const PointIndicesConstPtr &indices) |
Provide a pointer to the vector of indices that represents the input data. More... |
|
virtual void | setIndices (std::size_t row_start, std::size_t col_start, std::size_t nb_rows, std::size_t nb_cols) |
Set the indices for the points laying within an interest region of the point cloud. More... |
|
IndicesPtr | getIndices () |
Get a pointer to the vector of indices used. More... |
|
const IndicesConstPtr | getIndices () const |
Get a pointer to the vector of indices used. More... |
|
const PointT & | operator[] (std::size_t pos) const |
Override PointCloud operator[] to shorten code. More... |
|
Protected Member Functions | |
bool | buildGraph () |
This method simply builds the graph that will be used during the segmentation. More... |
|
void | calculateUnaryPotential (int point, double &source_weight, double &sink_weight) const |
Returns unary potential(data cost) for the given point index. More... |
|
bool | addEdge (int source, int target, double weight) |
This method simply adds the edge from the source point to the target point with a given weight. More... |
|
double | calculateBinaryPotential (int source, int target) const |
Returns the binary potential(smooth cost) for the given indices of points. More... |
|
bool | recalculateUnaryPotentials () |
This method recalculates unary potentials(data cost) if some changes were made, instead of creating new graph. More... |
|
bool | recalculateBinaryPotentials () |
This method recalculates binary potentials(smooth cost) if some changes were made, instead of creating new graph. More... |
|
void | assembleLabels (ResidualCapacityMap &residual_capacity) |
This method analyzes the residual network and assigns a label to every point in the cloud. More... |
|
Protected Member Functions inherited from pcl::PCLBase< PointT > | |
bool | initCompute () |
This method should get called before starting the actual computation. More... |
|
bool | deinitCompute () |
This method should get called after finishing the actual computation. More... |
|
Protected Attributes | |
double | inverse_sigma_ |
Stores the sigma coefficient. More... |
|
bool | binary_potentials_are_valid_ |
Signalizes if the binary potentials are valid. More... |
|
double | epsilon_ |
Used for comparison of the floating point numbers. More... |
|
double | radius_ |
Stores the distance to the background. More... |
|
bool | unary_potentials_are_valid_ |
Signalizes if the unary potentials are valid. More... |
|
double | source_weight_ |
Stores the weight for every edge that comes from source point. More... |
|
KdTreePtr | search_ |
Stores the search method that will be used for finding K nearest neighbors. More... |
|
unsigned int | number_of_neighbours_ |
Stores the number of neighbors to find. More... |
|
bool | graph_is_valid_ |
Signalizes if the graph is valid. More... |
|
std::vector< PointT, Eigen::aligned_allocator< PointT > > | foreground_points_ |
Stores the points that are known to be in the foreground. More... |
|
std::vector< PointT, Eigen::aligned_allocator< PointT > > | background_points_ |
Stores the points that are known to be in the background. More... |
|
std::vector< pcl::PointIndices > | clusters_ |
After the segmentation it will contain the segments. More... |
|
mGraphPtr | graph_ |
Stores the graph for finding the maximum flow. More... |
|
std::shared_ptr< CapacityMap > | capacity_ |
Stores the capacity of every edge in the graph. More... |
|
std::shared_ptr< ReverseEdgeMap > | reverse_edges_ |
Stores reverse edges for every edge in the graph. More... |
|
std::vector< VertexDescriptor > | vertices_ |
Stores the vertices of the graph. More... |
|
std::vector< std::set< int > > | edge_marker_ |
Stores the information about the edges that were added to the graph. More... |
|
VertexDescriptor | source_ |
Stores the vertex that serves as source. More... |
|
VertexDescriptor | sink_ |
Stores the vertex that serves as sink. More... |
|
double | max_flow_ |
Stores the maximum flow value that was calculated during the segmentation. More... |
|
Protected Attributes inherited from pcl::PCLBase< PointT > | |
PointCloudConstPtr | input_ |
The input point cloud dataset. More... |
|
IndicesPtr | indices_ |
A pointer to the vector of point indices to use. More... |
|
bool | use_indices_ |
Set to true if point indices are used. More... |
|
bool | fake_indices_ |
If no set of indices are given, we construct a set of fake indices that mimic the input PointCloud. More... |
|
This class implements the segmentation algorithm based on minimal cut of the graph.
The description can be found in the article: "Min-Cut Based Segmentation of Point Clouds"
Definition at line 59 of file min_cut_segmentation.h.
using pcl::MinCutSegmentation< PointT >::CapacityMap = boost::property_map< mGraph, boost::edge_capacity_t >::type |
Definition at line 87 of file min_cut_segmentation.h.
using pcl::MinCutSegmentation< PointT >::EdgeDescriptor = boost::graph_traits<mGraph>::edge_descriptor |
Definition at line 93 of file min_cut_segmentation.h.
using pcl::MinCutSegmentation< PointT >::IndexMap = boost::property_map< mGraph, boost::vertex_index_t >::type |
Definition at line 101 of file min_cut_segmentation.h.
using pcl::MinCutSegmentation< PointT >::InEdgeIterator = boost::graph_traits<mGraph>::in_edge_iterator |
Definition at line 103 of file min_cut_segmentation.h.
using pcl::MinCutSegmentation< PointT >::KdTree = pcl::search::Search<PointT> |
Definition at line 63 of file min_cut_segmentation.h.
using pcl::MinCutSegmentation< PointT >::KdTreePtr = typename KdTree::Ptr |
Definition at line 64 of file min_cut_segmentation.h.
using pcl::MinCutSegmentation< PointT >::mGraph = 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 > > > > |
Definition at line 85 of file min_cut_segmentation.h.
using pcl::MinCutSegmentation< PointT >::mGraphPtr = shared_ptr<mGraph> |
Definition at line 105 of file min_cut_segmentation.h.
using pcl::MinCutSegmentation< PointT >::OutEdgeIterator = boost::graph_traits<mGraph>::out_edge_iterator |
Definition at line 95 of file min_cut_segmentation.h.
using pcl::MinCutSegmentation< PointT >::PointCloud = pcl::PointCloud<PointT> |
Definition at line 65 of file min_cut_segmentation.h.
using pcl::MinCutSegmentation< PointT >::PointCloudConstPtr = typename PointCloud::ConstPtr |
Definition at line 66 of file min_cut_segmentation.h.
using pcl::MinCutSegmentation< PointT >::ResidualCapacityMap = boost::property_map< mGraph, boost::edge_residual_capacity_t >::type |
Definition at line 99 of file min_cut_segmentation.h.
using pcl::MinCutSegmentation< PointT >::ReverseEdgeMap = boost::property_map< mGraph, boost::edge_reverse_t>::type |
Definition at line 89 of file min_cut_segmentation.h.
using pcl::MinCutSegmentation< PointT >::Traits = boost::adjacency_list_traits< boost::vecS, boost::vecS, boost::directedS > |
Definition at line 75 of file min_cut_segmentation.h.
using pcl::MinCutSegmentation< PointT >::VertexDescriptor = Traits::vertex_descriptor |
Definition at line 91 of file min_cut_segmentation.h.
using pcl::MinCutSegmentation< PointT >::VertexIterator = boost::graph_traits<mGraph>::vertex_iterator |
Definition at line 97 of file min_cut_segmentation.h.
pcl::MinCutSegmentation< PointT >::MinCutSegmentation |
Constructor that sets default values for member variables.
Definition at line 50 of file min_cut_segmentation.hpp.
pcl::MinCutSegmentation< PointT >::~MinCutSegmentation |
Destructor that frees memory.
Definition at line 73 of file min_cut_segmentation.hpp.
| protected |
This method simply adds the edge from the source point to the target point with a given weight.
[in] | source | index of the source point of the edge |
[in] | target | index of the target point of the edge |
[in] | weight | weight that will be assigned to the (source, target) edge |
Definition at line 423 of file min_cut_segmentation.hpp.
| protected |
This method analyzes the residual network and assigns a label to every point in the cloud.
[in] | residual_capacity | residual network that was obtained during the segmentation |
Definition at line 534 of file min_cut_segmentation.hpp.
References pcl::PointIndices::indices.
| protected |
This method simply builds the graph that will be used during the segmentation.
Definition at line 303 of file min_cut_segmentation.hpp.
| protected |
Returns the binary potential(smooth cost) for the given indices of points.
In other words it returns weight that must be assigned to the edge from source to target point.
[in] | source | index of the source point of the edge |
[in] | target | index of the target point of the edge |
Definition at line 449 of file min_cut_segmentation.hpp.
References pcl::geometry::distance().
| protected |
Returns unary potential(data cost) for the given point index.
In other words it calculates weights for (source, point) and (point, sink) edges.
[in] | point | index of the point for which weights will be calculated |
[out] | source_weight | calculated weight for the (source, point) edge |
[out] | sink_weight | calculated weight for the (point, sink) edge |
Definition at line 367 of file min_cut_segmentation.hpp.
void pcl::MinCutSegmentation< PointT >::extract | ( | std::vector< pcl::PointIndices > & | clusters | ) |
This method launches the segmentation algorithm and returns the clusters that were obtained during the segmentation.
The indices of points that belong to the object will be stored in the cluster with index 1, other indices will be stored in the cluster with index 0.
[out] | clusters | clusters that were obtained. Each cluster is an array of point indices. |
Definition at line 218 of file min_cut_segmentation.hpp.
std::vector< PointT, Eigen::aligned_allocator< PointT > > pcl::MinCutSegmentation< PointT >::getBackgroundPoints |
Returns the points that must belong to background.
Definition at line 200 of file min_cut_segmentation.hpp.
pcl::PointCloud< pcl::PointXYZRGB >::Ptr pcl::MinCutSegmentation< PointT >::getColoredCloud |
Returns the colored cloud.
Points that belong to the object have the same color.
Definition at line 561 of file min_cut_segmentation.hpp.
References pcl::PointCloud< PointT >::height, pcl::PointCloud< PointT >::is_dense, pcl::PointCloud< PointT >::points, and pcl::PointCloud< PointT >::width.
std::vector< PointT, Eigen::aligned_allocator< PointT > > pcl::MinCutSegmentation< PointT >::getForegroundPoints |
Returns the points that must belong to foreground.
Definition at line 182 of file min_cut_segmentation.hpp.
pcl::MinCutSegmentation< PointT >::mGraphPtr pcl::MinCutSegmentation< PointT >::getGraph |
Returns the graph that was build for finding the minimum cut.
Definition at line 296 of file min_cut_segmentation.hpp.
double pcl::MinCutSegmentation< PointT >::getMaxFlow |
Returns that flow value that was calculated during the segmentation.
Definition at line 289 of file min_cut_segmentation.hpp.
unsigned int pcl::MinCutSegmentation< PointT >::getNumberOfNeighbours |
Returns the number of neighbours to find.
Definition at line 162 of file min_cut_segmentation.hpp.
double pcl::MinCutSegmentation< PointT >::getRadius |
Returns radius to the background.
Definition at line 112 of file min_cut_segmentation.hpp.
pcl::MinCutSegmentation< PointT >::KdTreePtr pcl::MinCutSegmentation< PointT >::getSearchMethod |
Returns search method that is used for finding KNN.
The graph is build such way that it contains the edges that connect point and its KNN.
Definition at line 148 of file min_cut_segmentation.hpp.
double pcl::MinCutSegmentation< PointT >::getSigma |
Returns normalization value for binary potentials.
For more information see the article.
Definition at line 94 of file min_cut_segmentation.hpp.
double pcl::MinCutSegmentation< PointT >::getSourceWeight |
Returns weight that every edge from the source point has.
Definition at line 130 of file min_cut_segmentation.hpp.
| protected |
This method recalculates binary potentials(smooth cost) if some changes were made, instead of creating new graph.
Definition at line 489 of file min_cut_segmentation.hpp.
| protected |
This method recalculates unary potentials(data cost) if some changes were made, instead of creating new graph.
Definition at line 464 of file min_cut_segmentation.hpp.
void pcl::MinCutSegmentation< PointT >::setBackgroundPoints | ( | typename pcl::PointCloud< PointT >::Ptr | background_points | ) |
Allows to specify points which are known to be the points of the background.
[in] | background_points | point cloud that contains background points. |
Definition at line 207 of file min_cut_segmentation.hpp.
References pcl::PointCloud< PointT >::cbegin(), and pcl::PointCloud< PointT >::cend().
void pcl::MinCutSegmentation< PointT >::setForegroundPoints | ( | typename pcl::PointCloud< PointT >::Ptr | foreground_points | ) |
Allows to specify points which are known to be the points of the object.
[in] | foreground_points | point cloud that contains foreground points. At least one point must be specified. |
Definition at line 189 of file min_cut_segmentation.hpp.
References pcl::PointCloud< PointT >::cbegin(), and pcl::PointCloud< PointT >::cend().
| overridevirtual |
This method simply sets the input point cloud.
[in] | cloud | the const boost shared pointer to a PointCloud |
Reimplemented from pcl::PCLBase< PointT >.
Definition at line 84 of file min_cut_segmentation.hpp.
void pcl::MinCutSegmentation< PointT >::setNumberOfNeighbours | ( | unsigned int | neighbour_number | ) |
Allows to set the number of neighbours to find.
[in] | neighbour_number | new number of neighbours |
Definition at line 169 of file min_cut_segmentation.hpp.
void pcl::MinCutSegmentation< PointT >::setRadius | ( | double | radius | ) |
Allows to set the radius to the background.
[in] | radius | new radius to the background |
Definition at line 119 of file min_cut_segmentation.hpp.
void pcl::MinCutSegmentation< PointT >::setSearchMethod | ( | const KdTreePtr & | tree | ) |
Allows to set search method for finding KNN.
The graph is build such way that it contains the edges that connect point and its KNN.
[in] | tree | search method that will be used for finding KNN. |
Definition at line 155 of file min_cut_segmentation.hpp.
void pcl::MinCutSegmentation< PointT >::setSigma | ( | double | sigma | ) |
Allows to set the normalization value for the binary potentials as described in the article.
[in] | sigma | new normalization value |
Definition at line 101 of file min_cut_segmentation.hpp.
void pcl::MinCutSegmentation< PointT >::setSourceWeight | ( | double | weight | ) |
Allows to set weight for source edges.
Every edge that comes from the source point will have that weight.
[in] | weight | new weight |
Definition at line 137 of file min_cut_segmentation.hpp.
| protected |
Stores the points that are known to be in the background.
Definition at line 293 of file min_cut_segmentation.h.
| protected |
Signalizes if the binary potentials are valid.
Definition at line 266 of file min_cut_segmentation.h.
| protected |
Stores the capacity of every edge in the graph.
Definition at line 302 of file min_cut_segmentation.h.
| protected |
After the segmentation it will contain the segments.
Definition at line 296 of file min_cut_segmentation.h.
| protected |
Stores the information about the edges that were added to the graph.
It is used to avoid the duplicate edges.
Definition at line 311 of file min_cut_segmentation.h.
| protected |
Used for comparison of the floating point numbers.
Definition at line 269 of file min_cut_segmentation.h.
| protected |
Stores the points that are known to be in the foreground.
Definition at line 290 of file min_cut_segmentation.h.
| protected |
Stores the graph for finding the maximum flow.
Definition at line 299 of file min_cut_segmentation.h.
| protected |
Signalizes if the graph is valid.
Definition at line 287 of file min_cut_segmentation.h.
| protected |
Stores the sigma coefficient.
It is used for finding smooth costs. More information can be found in the article.
Definition at line 263 of file min_cut_segmentation.h.
| protected |
Stores the maximum flow value that was calculated during the segmentation.
Definition at line 320 of file min_cut_segmentation.h.
| protected |
Stores the number of neighbors to find.
Definition at line 284 of file min_cut_segmentation.h.
| protected |
Stores the distance to the background.
Definition at line 272 of file min_cut_segmentation.h.
| protected |
Stores reverse edges for every edge in the graph.
Definition at line 305 of file min_cut_segmentation.h.
| protected |
Stores the search method that will be used for finding K nearest neighbors.
Neighbours are used for building the graph.
Definition at line 281 of file min_cut_segmentation.h.
| protected |
Stores the vertex that serves as sink.
Definition at line 317 of file min_cut_segmentation.h.
| protected |
Stores the vertex that serves as source.
Definition at line 314 of file min_cut_segmentation.h.
| protected |
Stores the weight for every edge that comes from source point.
Definition at line 278 of file min_cut_segmentation.h.
| protected |
Signalizes if the unary potentials are valid.
Definition at line 275 of file min_cut_segmentation.h.
| protected |
Stores the vertices of the graph.
Definition at line 308 of file min_cut_segmentation.h.
© 2009–2012, Willow Garage, Inc.
© 2012–, Open Perception, Inc.
Licensed under the BSD License.
https://pointclouds.org/documentation/classpcl_1_1_min_cut_segmentation.html