-
Notifications
You must be signed in to change notification settings - Fork 767
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding serialization support to be used for GT-SFM (#650)
* adding serialization and other functions to enable testing * adding track serialization and testable trait * improving formatting * fixing variable names and comments * adding serialization functions to wrapper * fixing xml serialization issues * reverting SfmTrack to struct * printing out the 3d point * adding equals function to wrapper * adding inline comment for round trip
- Loading branch information
Showing
3 changed files
with
191 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* ---------------------------------------------------------------------------- | ||
* 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 testSerializationDataset.cpp | ||
* @brief serialization tests for dataset.cpp | ||
* @author Ayush Baid | ||
* @date Jan 1, 2021 | ||
*/ | ||
|
||
#include <gtsam/slam/dataset.h> | ||
|
||
#include <gtsam/base/serializationTestHelpers.h> | ||
#include <CppUnitLite/TestHarness.h> | ||
|
||
using namespace std; | ||
using namespace gtsam; | ||
using namespace gtsam::serializationTestHelpers; | ||
|
||
/* ************************************************************************* */ | ||
TEST(dataSet, sfmDataSerialization) { | ||
// Test the serialization of SfmData | ||
const string filename = findExampleDataFile("dubrovnik-3-7-pre"); | ||
SfmData mydata; | ||
CHECK(readBAL(filename, mydata)); | ||
|
||
// round-trip equality check on serialization and subsequent deserialization | ||
EXPECT(equalsObj(mydata)); | ||
EXPECT(equalsXML(mydata)); | ||
EXPECT(equalsBinary(mydata)); | ||
} | ||
|
||
/* ************************************************************************* */ | ||
TEST(dataSet, sfmTrackSerialization) { | ||
// Test the serialization of SfmTrack | ||
const string filename = findExampleDataFile("dubrovnik-3-7-pre"); | ||
SfmData mydata; | ||
CHECK(readBAL(filename, mydata)); | ||
|
||
SfmTrack track = mydata.track(0); | ||
|
||
// round-trip equality check on serialization and subsequent deserialization | ||
EXPECT(equalsObj(track)); | ||
EXPECT(equalsXML(track)); | ||
EXPECT(equalsBinary(track)); | ||
} | ||
|
||
/* ************************************************************************* */ | ||
int main() { TestResult tr; return TestRegistry::runAllTests(tr); } | ||
/* ************************************************************************* */ |