
This class computes edge weights for a given point cloud graph. More...
#include <VisionX/libraries/PointCloudGraph/edge_weight_computer.h>
Public Types  
enum  NormalizationType { NORMALIZATION_NONE, NORMALIZATION_GLOBAL, NORMALIZATION_LOCAL } 
Different normalization types that could be applied to a term. More...  
typedef pcl::graph::point_cloud_graph_traits< GraphT >::point_type  PointT 
typedef boost::shared_ptr< EdgeWeightComputer >  Ptr 
enum  SmallWeightPolicy { SMALL_WEIGHT_IGNORE, SMALL_WEIGHT_COERCE_TO_THRESHOLD, SMALL_WEIGHT_REMOVE_EDGE } 
Policy which controls what happens to edges with small weights (i.e. More...  
typedef boost::function< float(float, float)>  TermBalancingFunction 
Public Member Functions  
template<typename TermT >  
void  addTerm (float influence, float convex_influence_multiplier=1.0, NormalizationType normalization=NORMALIZATION_NONE) 
Add a term to the edge weighting function. More...  
template<typename TermT >  
void  addTerm (float influence, NormalizationType normalization) 
Add a term to the edge weighting function. More...  
void  compute (GraphT &graph) 
Compute weights for the edges in a given graph. More...  
template<typename EdgeWeightMap >  
void  compute (GraphT &graph, EdgeWeightMap weights) 
Compute weights for the edges in a given graph. More...  
EdgeWeightComputer ()  
Construct a weight computer with default settings. More...  
void  setSmallWeightPolicy (SmallWeightPolicy policy) 
Set the policy for edges with small (below threshold) weights. More...  
void  setSmallWeightThreshold (float threshold) 
Set the threshold for edge weights. More...  
void  setTermBalancingFunction (TermBalancingFunction func) 
Set the function used to balance the contributions of the terms. More...  
This class computes edge weights for a given point cloud graph.
The compute() function interates over graph edges and calculates their weights based on the data contained in their end vertices. The general form of the weighting function used in calculation is fixed, however the user is provided with a means to customize it.
For a pair of vertices and connected by an edge, the weight is computed as a product of independent terms:
Each term has the following form:
is a balancing function. Its first argument is a value calculated from the vertex data, and the second argument controls the influence of the term. An example of a balancing function is Gaussian:
The value that is fed to the balancing function is calculated based on the data in the vertices; it consists of a distance between vertices (in numerator) and a normalization term (in denominator). The former is called "distance" because typically it is indeed a distance function, such as Euclidean distance between 3D points, or angular distance between point normals. The normalization term is needed to account for the cases when the distance has a significant global variation over the graph.
A few commonly used terms are predefined; they are presented below using the following notation. Given a point cloud graph vertex , denotes the 3D coordinates of the associated point, denotes the normal orientation of the associated point, is a vector consisting of R, G, and B components of the color of the associated point, and denotes the curvature of the associated point.
XYZ term (Euclidean distance between points)
Normal term (angular distance between normals)
Curvature term (product of point curvatures)
RGB term (Euclidean distance in RGB space)
Three types of normalization (defined by the NormalizationType enum) are available:
No normalization, the term is left as is.
Normalize term by the average value of the corresponding distance over all edges in the graph.
Normalize term by the average value of the corresponding distance over all edges incident to the end points of the edge.
After the edge weights were computed, there is an optional step where the weights or the edge set of the graph may be modified to ensure that there are no edges with weights that are "too small". This is useful e.g. if the further processing involves solving linear systems based on adjacency matrix of the graph. Leaving smallish weights might lead to numerical problems in that case.
The threshold is controlled by the setSmallWeightThreshold() function. The policies are defined by the SmallWeightPolicy enum and may be set using setSmallWeightPolicy() function.
The following code snippet demonstrates a typical usage of the EdgeWeightComputer class:
Definition at line 196 of file edge_weight_computer.h.
typedef pcl::graph::point_cloud_graph_traits<GraphT>::point_type PointT 
Definition at line 203 of file edge_weight_computer.h.
typedef boost::shared_ptr<EdgeWeightComputer> Ptr 
Definition at line 205 of file edge_weight_computer.h.
typedef boost::function<float (float, float)> TermBalancingFunction 
Definition at line 204 of file edge_weight_computer.h.
enum NormalizationType 
Different normalization types that could be applied to a term.
Enumerator  

NORMALIZATION_NONE  No normalization. 
NORMALIZATION_GLOBAL  Global normalization. 
NORMALIZATION_LOCAL  Local normalization. 
Definition at line 208 of file edge_weight_computer.h.
enum SmallWeightPolicy 
Policy which controls what happens to edges with small weights (i.e.
below userspecified threshold).
Definition at line 220 of file edge_weight_computer.h.

inline 
Construct a weight computer with default settings.
By default the small weight threshold is set to zero, and the edges with small weights are ignored. The default term balancing function is Gaussian.
Definition at line 239 of file edge_weight_computer.h.

inline 
Add a term to the edge weighting function.
[in]  influence  that will be passed to the balancing function 
[in]  convex_influence_multiplier  an influence multiplier that will be applied if the edge is convex (default: 1.0, i.e. no diffirence between concave and convex edges). 
[in]  normalization  normalization type for the term (default: NORMALIZATION_NONE, i.e. no normalization). 
Definition at line 286 of file edge_weight_computer.h.

inline 
Add a term to the edge weighting function.
This is an overloaded function provided for convenience. See the documentation for addTerm().
Definition at line 299 of file edge_weight_computer.h.

inline 
Compute weights for the edges in a given graph.
This function interates over graph edges and calculates their weights based on the data contained in their end vertices. See class documentation for more information.
This version stores computed weights in internal property map.
[in]  graph  a point cloud graph 
Definition at line 269 of file edge_weight_computer.h.
void compute  (  GraphT &  graph, 
EdgeWeightMap  weights  
) 
Compute weights for the edges in a given graph.
This function iterates over graph edges and calculates their weights based on the data contained in their end vertices. See class documentation for more information.
This version stores computed weights in external property map.
[in]  graph  a point cloud graph 
[in]  weights  an external edge weight property map 
Definition at line 112 of file edge_weight_computer.hpp.

inline 
Set the policy for edges with small (below threshold) weights.
Definition at line 308 of file edge_weight_computer.h.

inline 
Set the threshold for edge weights.
Definition at line 315 of file edge_weight_computer.h.

inline 
Set the function used to balance the contributions of the terms.
Definition at line 322 of file edge_weight_computer.h.