minor comments change
parent
c1c8b0a1a3
commit
0eec6fbeec
|
|
@ -120,7 +120,7 @@ std::map<KeyPair, double> MFAS::computeOutlierWeights() {
|
|||
|
||||
for (auto it = start; it != end; it++) {
|
||||
// relativeTranslations may have negative weight edges, we make sure all edges
|
||||
// are along the postive direction by flipping them if they are not.
|
||||
// are along the positive direction by flipping them if they are not.
|
||||
KeyPair edge = it->first;
|
||||
if (positiveEdgeWeights_.find(edge) == positiveEdgeWeights_.end()) {
|
||||
std::swap(edge.first, edge.second);
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ namespace gtsam {
|
|||
using KeyPair = std::pair<Key, Key>;
|
||||
using TranslationEdges = std::map<KeyPair, Unit3>;
|
||||
|
||||
/*
|
||||
/**
|
||||
The MFAS class to solve a Minimum feedback arc set (MFAS)
|
||||
problem. We implement the solution from:
|
||||
Kyle Wilson and Noah Snavely, "Robust Global Translations with 1DSfM",
|
||||
|
|
@ -34,12 +34,13 @@ using TranslationEdges = std::map<KeyPair, Unit3>;
|
|||
Given a weighted directed graph, the objective in a Minimum feedback arc set
|
||||
problem is to obtain a graph that does not contain any cycles by removing
|
||||
edges such that the total weight of removed edges is minimum.
|
||||
@addtogroup SFM
|
||||
*/
|
||||
class MFAS {
|
||||
public:
|
||||
/*
|
||||
/**
|
||||
* @brief Construct from the nodes in a graph (points in 3D), edges
|
||||
* that are transation directions in 3D and the direction in
|
||||
* that are translation directions in 3D and the direction in
|
||||
* which edges are to be projected.
|
||||
* @param nodes Nodes in the graph
|
||||
* @param relativeTranslations translation directions between nodes
|
||||
|
|
@ -49,8 +50,8 @@ class MFAS {
|
|||
const std::shared_ptr<TranslationEdges> &relativeTranslations,
|
||||
const Unit3 &projectionDirection);
|
||||
|
||||
/*
|
||||
* Construct from the nodes in a graph and weighted directed edges
|
||||
/**
|
||||
* @brief Construct from the nodes in a graph and weighted directed edges
|
||||
* between the graph. Not recommended for any purpose other than unit testing.
|
||||
* The computeOutlierWeights method will return an empty output if this constructor
|
||||
* is used.
|
||||
|
|
@ -62,7 +63,7 @@ class MFAS {
|
|||
MFAS(const std::shared_ptr<std::vector<Key>> &nodes,
|
||||
const std::map<KeyPair, double> &edgeWeights);
|
||||
|
||||
/*
|
||||
/**
|
||||
* @brief Computes the "outlier weights" of the graph. We define the outlier weight
|
||||
* of a edge to be zero if the edge in an inlier and the magnitude of its edgeWeight
|
||||
* if it is an outlier. This function can only be used when constructing the
|
||||
|
|
@ -70,8 +71,8 @@ class MFAS {
|
|||
*/
|
||||
std::map<KeyPair, double> computeOutlierWeights();
|
||||
|
||||
/*
|
||||
* Computes the 1D MFAS ordering of nodes in the graph
|
||||
/**
|
||||
* @brief Computes the 1D MFAS ordering of nodes in the graph
|
||||
* @return orderedNodes: vector of nodes in the obtained order
|
||||
*/
|
||||
std::vector<Key> computeOrdering();
|
||||
|
|
|
|||
|
|
@ -5,12 +5,14 @@
|
|||
using namespace std;
|
||||
using namespace gtsam;
|
||||
|
||||
/* We (partially) use the example from the paper on 1dsfm
|
||||
/**
|
||||
* We (partially) use the example from the paper on 1dsfm
|
||||
* (https://research.cs.cornell.edu/1dsfm/docs/1DSfM_ECCV14.pdf, Fig 1, Page 5)
|
||||
* for the unit tests here. The only change is that we leave out node 4 and use
|
||||
* only nodes 0-3. This makes the test easier to understand and also
|
||||
* avoids an ambiguity in the ground truth ordering that arises due to
|
||||
* insufficient edges in the geaph when using the 4th node. */
|
||||
* insufficient edges in the geaph when using the 4th node.
|
||||
*/
|
||||
|
||||
// edges in the graph - last edge from node 3 to 0 is an outlier
|
||||
vector<KeyPair> graph = {make_pair(3, 2), make_pair(0, 1), make_pair(3, 1),
|
||||
|
|
|
|||
Loading…
Reference in New Issue