|
|
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. | |
| template<typename TermT> | |
| void | addTerm (float influence, NormalizationType normalization) |
| Add a term to the edge weighting function. | |
| void | compute (GraphT &graph) |
| Compute weights for the edges in a given graph. | |
| template<typename EdgeWeightMap> | |
| void | compute (GraphT &graph, EdgeWeightMap weights) |
| Compute weights for the edges in a given graph. | |
| EdgeWeightComputer () | |
| Construct a weight computer with default settings. | |
| void | setSmallWeightPolicy (SmallWeightPolicy policy) |
| Set the policy for edges with small (below threshold) weights. | |
| void | setSmallWeightThreshold (float threshold) |
| Set the threshold for edge weights. | |
| void | setTermBalancingFunction (TermBalancingFunction func) |
| Set the function used to balance the contributions of the terms. | |
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 


![\[ w_{ij} =
Term_1\left(v_i,v_j\right) \cdot
\dots \cdot
Term_k\left(v_i,v_j\right)
\]](../../form_15.png)
Each term has the following form:
![\[ Term\left(v_i,v_j\right) =
\phi\left(\frac{d\left(v_i,v_j\right)}
{\bar{d}\left(v_i,v_j\right)}, \sigma\right)
\]](../../form_16.png)

![\[ \phi\left(x,\sigma\right) =
\exp{\left\{-\frac{x}{\sigma}\right\}}
\]](../../form_18.png)
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 

A few commonly used terms are predefined; they are presented below using the following notation. Given a point cloud graph vertex 








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:
| typedef pcl::graph::point_cloud_graph_traits<GraphT>::point_type PointT |
| typedef boost::shared_ptr<EdgeWeightComputer> Ptr |
| typedef boost::function<float(float, float)> TermBalancingFunction |
| enum NormalizationType |
| enum SmallWeightPolicy |
Policy which controls what happens to edges with small weights (i.e.
below user-specified threshold).
|
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.
|
inline |
Add a term to the edge weighting function.
| [in] | influence | ![]() |
| [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). |
|
inline |
Add a term to the edge weighting function.
This is an overloaded function provided for convenience. See the documentation for addTerm().
|
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 |
| 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 |
|
inline |
Set the policy for edges with small (below threshold) weights.
|
inline |
Set the threshold for edge weights.
|
inline |
Set the function used to balance the contributions of the terms.