From e95840b1b5cb318f2fdf3a45112d032f28e92379 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Thu, 3 Sep 2020 00:33:38 -0400 Subject: [PATCH 1/2] new function readBal which returns the SfmData object, allowing for single line calling --- gtsam/slam/dataset.cpp | 7 +++++++ gtsam/slam/dataset.h | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/gtsam/slam/dataset.cpp b/gtsam/slam/dataset.cpp index 4bd7bc7e2..4506bcdb2 100644 --- a/gtsam/slam/dataset.cpp +++ b/gtsam/slam/dataset.cpp @@ -1129,6 +1129,13 @@ bool readBAL(const string &filename, SfmData &data) { return true; } +/* ************************************************************************* */ +SfmData readBAL(const string &filename) { + SfmData data; + readBAL(filename, data); + return data; +} + /* ************************************************************************* */ bool writeBAL(const string &filename, SfmData &data) { // Open the output file diff --git a/gtsam/slam/dataset.h b/gtsam/slam/dataset.h index 7ceca00f4..0bcdd7e8e 100644 --- a/gtsam/slam/dataset.h +++ b/gtsam/slam/dataset.h @@ -277,6 +277,14 @@ GTSAM_EXPORT bool readBundler(const std::string& filename, SfmData &data); */ GTSAM_EXPORT bool readBAL(const std::string& filename, SfmData &data); +/** + * @brief This function parses a "Bundle Adjustment in the Large" (BAL) file and returns the data + * as a SfmData structure. Mainly used by wrapped code. + * @param filename The name of the BAL file. + * @return SfM structure where the data is stored. + */ +GTSAM_EXPORT SfmData readBAL(const std::string& filename); + /** * @brief This function writes a "Bundle Adjustment in the Large" (BAL) file from a * SfmData structure From f533729d3eaf9f0a44323d655d694af2c1f9ea51 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Thu, 3 Sep 2020 00:43:44 -0400 Subject: [PATCH 2/2] follow Google Style for function naming --- gtsam/slam/dataset.cpp | 2 +- gtsam/slam/dataset.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gtsam/slam/dataset.cpp b/gtsam/slam/dataset.cpp index 4506bcdb2..270dbeb95 100644 --- a/gtsam/slam/dataset.cpp +++ b/gtsam/slam/dataset.cpp @@ -1130,7 +1130,7 @@ bool readBAL(const string &filename, SfmData &data) { } /* ************************************************************************* */ -SfmData readBAL(const string &filename) { +SfmData readBal(const string &filename) { SfmData data; readBAL(filename, data); return data; diff --git a/gtsam/slam/dataset.h b/gtsam/slam/dataset.h index 0bcdd7e8e..2e03c92d8 100644 --- a/gtsam/slam/dataset.h +++ b/gtsam/slam/dataset.h @@ -283,7 +283,7 @@ GTSAM_EXPORT bool readBAL(const std::string& filename, SfmData &data); * @param filename The name of the BAL file. * @return SfM structure where the data is stored. */ -GTSAM_EXPORT SfmData readBAL(const std::string& filename); +GTSAM_EXPORT SfmData readBal(const std::string& filename); /** * @brief This function writes a "Bundle Adjustment in the Large" (BAL) file from a