/* ---------------------------------------------------------------------------- * GTSAM Copyright 2010, Georgia Tech Research Corporation, * Atlanta, Georgia 30332-0415 * All Rights Reserved * Authors: Frank Dellaert, et al. (see THANKS for the full author list) * See LICENSE for the license information * -------------------------------------------------------------------------- */ /** * @file VisualSLAMExample.cpp * @brief A visualSLAM example for the structure-from-motion problem on a simulated dataset * @author Duy-Nguyen Ta */ #include #include #include #include #include "VisualSLAMData.h" using namespace std; using namespace gtsam; // Convenience for named keys using symbol_shorthand::X; using symbol_shorthand::L; /* ************************************************************************* */ int main(int argc, char* argv[]) { VisualSLAMExampleData data = VisualSLAMExampleData::generate(); /* 1. Create graph *///using the 2D measurements (features) and the calibration data visualSLAM::Graph graph; /* 2. Add factors to the graph */ // 2a. Measurement factors for (size_t i=0; isample())); for (size_t j=0; jsample())); initial.print("Intial Estimates: "); /* 4. Optimize the graph and print results */ visualSLAM::Values result = GaussNewtonOptimizer(graph, initial).optimize(); // visualSLAM::Values result = LevenbergMarquardtOptimizer(graph, initial).optimize(); result.print("Final results: "); return 0; } /* ************************************************************************* */