Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling edges with pure rotation in translation averaging #619

Merged
merged 4 commits into from
Dec 2, 2020

Conversation

akshay-krishnan
Copy link
Contributor

Changing the translation averaging implementation to handle edges in the input graph that are a pure rotation. These edges have a "zero" Unit3 translation direction.

Major changes in the PR:

  • Additional unit tests to check for cases with and without pure rotation edges.
  • Uses a DSFmap to consider all nodes that are connected by a "pure rotation edge" as the same node. After optimization, the result for the single node is used for all nodes that are at the same point.

Copy link
Member

@dellaert dellaert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some small comments. Document your changes, esp indicating where you do something special for zero translation case, and I'll do a second review.

EXPECT(assert_equal(expected, result.at<Point3>(2), 1e-4));

// TODO(frank): how to get stats back?
// EXPECT_DOUBLES_EQUAL(0.0199833, actualError, 1e-5);
}

TEST(TranslationRecovery, TwoPointTest) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TwoPoseTest ?

EXPECT(assert_equal(Point3(2, 0, 0), result.at<Point3>(1)));
}

TEST(TranslationRecovery, ThreePointTest) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

EXPECT_LONGS_EQUAL(1, graph.size());

// Run translation recovery
const auto result = algorithm.run(/*scale=*/2.0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe use a different scale from the true scale to check that functionality?

const auto graph = algorithm.buildGraph();
EXPECT_LONGS_EQUAL(3, graph.size());

const auto result = algorithm.run(/*scale=*/2.0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

EXPECT(assert_equal(Point3(1, -1, 0), result.at<Point3>(3)));
}

TEST(TranslationRecovery, TwoPointsAndZeroTranslation) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ThreePosesIncludingZeroTranslation

EXPECT(assert_equal(Point3(2, 0, 0), result.at<Point3>(2)));
}

TEST(TranslationRecovery, ThreePointsAndZeroTranslation) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FourPosesIncluding...

gtsam/sfm/TranslationRecovery.cpp Show resolved Hide resolved
gtsam/sfm/TranslationRecovery.cpp Show resolved Hide resolved
Copy link
Member

@dellaert dellaert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really great! Just a few more nits :-)

@@ -16,14 +16,16 @@
* @brief Recovering translations in an epipolar graph when rotations are given.
*/

#include <map>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Include only what you really need in the header, include others in .cpp only

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

std::map is used in line 59 below, for sameTranslationNodes_.

@@ -54,21 +56,22 @@ class TranslationRecovery {
private:
TranslationEdges relativeTranslations_;
LevenbergMarquardtParams params_;
std::map<Key, std::set<Key>> sameTranslationNodes_;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

document all of these with at least a ///< one-liner after declaration

@akshay-krishnan
Copy link
Contributor Author

Thank you Frank, I've added some documentation for the member variables.

@dellaert
Copy link
Member

dellaert commented Dec 1, 2020

OK, feel free to merge and delete branch after checks have passed :-)

@akshay-krishnan akshay-krishnan merged commit d6f7da7 into develop Dec 2, 2020
@akshay-krishnan akshay-krishnan deleted the fix/zero_translation_avg branch December 2, 2020 03:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants