gtsam  4.1.0
gtsam
MFAS.h
Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2 
3  * GTSAM Copyright 2010-2020, Georgia Tech Research Corporation,
4  * Atlanta, Georgia 30332-0415
5  * All Rights Reserved
6  * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7 
8  * See LICENSE for the license information
9 
10  * -------------------------------------------------------------------------- */
11 
12 #pragma once
13 
21 #include <gtsam/geometry/Unit3.h>
22 #include <gtsam/inference/Key.h>
24 
25 #include <memory>
26 #include <unordered_map>
27 #include <vector>
28 
29 namespace gtsam {
30 
51 class MFAS {
52  public:
53  // used to represent edges between two nodes in the graph. When used in
54  // translation averaging for global SfM
55  using KeyPair = std::pair<Key, Key>;
56  using TranslationEdges = std::vector<BinaryMeasurement<Unit3>>;
57 
58  private:
59  // edges with a direction such that all weights are positive
60  // i.e, edges that originally had negative weights are flipped
61  std::map<KeyPair, double> edgeWeights_;
62 
63  public:
69  MFAS(const std::map<KeyPair, double> &edgeWeights)
70  : edgeWeights_(edgeWeights) {}
71 
80  MFAS(const TranslationEdges &relativeTranslations,
81  const Unit3 &projectionDirection);
82 
87  KeyVector computeOrdering() const;
88 
96  std::map<KeyPair, double> computeOutlierWeights() const;
97 };
98 
99 typedef std::map<std::pair<Key, Key>, double> KeyPairDoubleMap;
100 
101 } // namespace gtsam
gtsam::MFAS::computeOutlierWeights
std::map< KeyPair, double > computeOutlierWeights() const
Computes the outlier weights of the graph.
Definition: MFAS.cpp:141
BinaryMeasurement.h
Binary measurement represents a measurement between two keys in a graph. A binary measurement is simi...
gtsam
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
gtsam::MFAS::MFAS
MFAS(const std::map< KeyPair, double > &edgeWeights)
Construct from the weighted directed edges between the nodes.
Definition: MFAS.h:69
Key.h
gtsam::Unit3
Represents a 3D point on a unit sphere.
Definition: Unit3.h:42
gtsam::MFAS::computeOrdering
KeyVector computeOrdering() const
Computes the 1D MFAS ordering of nodes in the graph.
Definition: MFAS.cpp:124
gtsam::KeyVector
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
Definition: Key.h:86
gtsam::MFAS
Definition: MFAS.h:51