From 707c745aad93f2fbf0ff566cbac37b906dd9009d Mon Sep 17 00:00:00 2001 From: Frank Dellaert Date: Tue, 24 Dec 2013 16:47:30 -0500 Subject: [PATCH] Created second example --- .cproject | 356 ++++++++++++++++-------------- examples/CreateSFMExampleData.cpp | 65 +++++- examples/Data/5pointExample2.txt | 65 ++++++ 3 files changed, 305 insertions(+), 181 deletions(-) create mode 100644 examples/Data/5pointExample2.txt diff --git a/.cproject b/.cproject index 21ab6965c..19be6b629 100644 --- a/.cproject +++ b/.cproject @@ -365,38 +365,6 @@ true true - - make - -j2 - all - true - true - true - - - make - -j2 - testNonlinearConstraint.run - true - true - true - - - make - -j2 - testLieConfig.run - true - true - true - - - make - -j2 - testConstraintOptimizer.run - true - true - true - make -j5 @@ -477,6 +445,38 @@ true true + + make + -j2 + all + true + true + true + + + make + -j2 + testNonlinearConstraint.run + true + true + true + + + make + -j2 + testLieConfig.run + true + true + true + + + make + -j2 + testConstraintOptimizer.run + true + true + true + make -j2 @@ -551,6 +551,7 @@ make + tests/testBayesTree.run true false @@ -558,6 +559,7 @@ make + testBinaryBayesNet.run true false @@ -605,6 +607,7 @@ make + testSymbolicBayesNet.run true false @@ -612,6 +615,7 @@ make + tests/testSymbolicFactor.run true false @@ -619,6 +623,7 @@ make + testSymbolicFactorGraph.run true false @@ -634,19 +639,12 @@ make + tests/testBayesTree true false true - - make - -j2 - testVSLAMGraph - true - true - true - make -j2 @@ -729,7 +727,6 @@ make - testSimulated2DOriented.run true false @@ -769,7 +766,6 @@ make - testSimulated2D.run true false @@ -777,7 +773,6 @@ make - testSimulated3D.run true false @@ -791,6 +786,14 @@ true true + + make + -j2 + testVSLAMGraph + true + true + true + make -j2 @@ -830,6 +833,21 @@ false true + + make + -j2 + check + true + true + true + + + make + tests/testGaussianISAM2 + true + false + true + make -j5 @@ -968,6 +986,7 @@ make + testGraph.run true false @@ -975,6 +994,7 @@ make + testJunctionTree.run true false @@ -982,6 +1002,7 @@ make + testSymbolicBayesNetB.run true false @@ -1043,22 +1064,6 @@ true true - - make - -j2 - check - true - true - true - - - make - - tests/testGaussianISAM2 - true - false - true - make -j2 @@ -1427,14 +1432,6 @@ true true - - make - -j2 - testGaussianFactor.run - true - true - true - make -j2 @@ -1515,66 +1512,10 @@ true true - + make -j2 - check - true - true - true - - - make - -j2 - testClusterTree.run - true - true - true - - - make - -j2 - testJunctionTree.run - true - true - true - - - make - -j2 - tests/testEliminationTree.run - true - true - true - - - make - -j2 - tests/testSymbolicFactor.run - true - true - true - - - make - -j2 - tests/testVariableSlots.run - true - true - true - - - make - -j2 - tests/testConditional.run - true - true - true - - - make - -j2 - tests/testSymbolicFactorGraph.run + testGaussianFactor.run true true true @@ -1675,6 +1616,86 @@ true true + + make + -j2 + check + true + true + true + + + make + -j2 + testClusterTree.run + true + true + true + + + make + -j2 + testJunctionTree.run + true + true + true + + + make + -j2 + tests/testEliminationTree.run + true + true + true + + + make + -j2 + tests/testSymbolicFactor.run + true + true + true + + + make + -j2 + tests/testVariableSlots.run + true + true + true + + + make + -j2 + tests/testConditional.run + true + true + true + + + make + -j2 + tests/testSymbolicFactorGraph.run + true + true + true + + + make + -j2 + all + true + true + true + + + make + -j2 + clean + true + true + true + make -j5 @@ -1739,22 +1760,6 @@ true true - - make - -j2 - all - true - true - true - - - make - -j2 - clean - true - true - true - make -j2 @@ -1867,6 +1872,14 @@ true true + + make + -j5 + CreateSFMExampleData.run + true + true + true + make -j2 @@ -2188,6 +2201,7 @@ cpack + -G DEB true false @@ -2195,6 +2209,7 @@ cpack + -G RPM true false @@ -2202,6 +2217,7 @@ cpack + -G TGZ true false @@ -2209,6 +2225,7 @@ cpack + --config CPackSourceConfig.cmake true false @@ -2382,6 +2399,30 @@ true true + + make + -j2 + check + true + true + true + + + make + -j2 + tests/testSPQRUtil.run + true + true + true + + + make + -j2 + clean + true + true + true + make -j5 @@ -2422,26 +2463,18 @@ true true - + make -j2 - check + tests/testPose2.run true true true - + make -j2 - tests/testSPQRUtil.run - true - true - true - - - make - -j2 - clean + tests/testPose3.run true true true @@ -2536,27 +2569,12 @@ make + testErrors.run true false true - - make - -j2 - tests/testPose2.run - true - true - true - - - make - -j2 - tests/testPose3.run - true - true - true - diff --git a/examples/CreateSFMExampleData.cpp b/examples/CreateSFMExampleData.cpp index b62b1c6fa..bcc0b6320 100644 --- a/examples/CreateSFMExampleData.cpp +++ b/examples/CreateSFMExampleData.cpp @@ -17,28 +17,29 @@ #include #include + +#include #include using namespace boost::assign; using namespace std; using namespace gtsam; -void create5PointExample1() { +/* ************************************************************************* */ + +void createExampleBALFile(const string& filename, const vector& P, + const Pose3& pose1, const Pose3& pose2, const Cal3Bundler& K = + Cal3Bundler()) { // Class that will gather all data SfM_data data; - // Create two cameras and corresponding essential matrix E + // Create two cameras Rot3 aRb = Rot3::yaw(M_PI_2); Point3 aTb(0.1, 0, 0); Pose3 identity, aPb(aRb, aTb); - data.cameras.push_back(SfM_Camera(identity)); - data.cameras.push_back(SfM_Camera(aPb)); - - // Create test data, we need at least 5 points - vector P; - P += Point3(0, 0, 1), Point3(-0.1, 0, 1), Point3(0.1, 0, 1), // - Point3(0, 0.5, 0.5), Point3(0, -0.5, 0.5); + data.cameras.push_back(SfM_Camera(pose1, K)); + data.cameras.push_back(SfM_Camera(pose2, K)); BOOST_FOREACH(const Point3& p, P) { @@ -51,19 +52,59 @@ void create5PointExample1() { // Project points in both cameras for (size_t i = 0; i < 2; i++) - track.measurements.push_back(make_pair(i, data.cameras[i].project(p))); + track.measurements.push_back(make_pair(i, data.cameras[i].project(p))); // Add track to data data.tracks.push_back(track); } - // Assumes example is run in ${GTSAM_TOP}/build/examples - const string filename = "../../examples/data/5pointExample1.txt"; writeBAL(filename, data); } +/* ************************************************************************* */ + +void create5PointExample1() { + + // Create two cameras poses + Rot3 aRb = Rot3::yaw(M_PI_2); + Point3 aTb(0.1, 0, 0); + Pose3 pose1, pose2(aRb, aTb); + + // Create test data, we need at least 5 points + vector P; + P += Point3(0, 0, 1), Point3(-0.1, 0, 1), Point3(0.1, 0, 1), // + Point3(0, 0.5, 0.5), Point3(0, -0.5, 0.5); + + // Assumes example is run in ${GTSAM_TOP}/build/examples + const string filename = "../../examples/data/5pointExample1.txt"; + createExampleBALFile(filename, P, pose1, pose2); +} + +/* ************************************************************************* */ + +void create5PointExample2() { + + // Create two cameras poses + Rot3 aRb = Rot3::yaw(M_PI_2); + Point3 aTb(10, 0, 0); + Pose3 pose1, pose2(aRb, aTb); + + // Create test data, we need at least 5 points + vector P; + P += Point3(0, 0, 100), Point3(-10, 0, 100), Point3(10, 0, 100), // + Point3(0, 50, 50), Point3(0, -50, 50), Point3(-20, 0, 80), Point3(20, -50, 80); + + // Assumes example is run in ${GTSAM_TOP}/build/examples + const string filename = "../../examples/data/5pointExample2.txt"; + Cal3Bundler K(500, 0, 0); + createExampleBALFile(filename, P, pose1, pose2,K); +} + +/* ************************************************************************* */ + int main(int argc, char* argv[]) { create5PointExample1(); + create5PointExample2(); return 0; } diff --git a/examples/Data/5pointExample2.txt b/examples/Data/5pointExample2.txt new file mode 100644 index 000000000..1aa57d59d --- /dev/null +++ b/examples/Data/5pointExample2.txt @@ -0,0 +1,65 @@ +2 7 14 + +0 0 0 -0 +1 0 -3.0616169978683830426e-15 -50 +0 1 -50 -0 +1 1 -6.1232339957367660852e-15 -100 +0 2 50 -0 +1 2 0 -0 +0 3 0 -500 +1 3 500 -100.00000000000002842 +0 4 0 500 +1 4 -500 -99.999999999999957367 +0 5 -125 -0 +1 5 -1.1481063742006437494e-14 -187.5 +0 6 125 312.5 +1 6 -312.5 62.500000000000028422 + +3.141592653589793116 +0 +0 +-0 +0 +0 +500 +0 +0 + +2.2214414690791830509 +2.2214414690791826068 +0 +-6.1232339957367662824e-16 +-10 +0 +500 +0 +0 + +0 +0 +100 + +-10 +0 +100 + +10 +0 +100 + +0 +50 +50 + +0 +-50 +50 + +-20 +0 +80 + +20 +-50 +80 +