testSerializationDataset.cpp
Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2 
3  * GTSAM Copyright 2010, Georgia Tech Research Corporation,
4  * Atlanta, Georgia 30332-0415
5  * All Rights Reserved
6  * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7 
8  * See LICENSE for the license information
9 
10  * -------------------------------------------------------------------------- */
11 
19 #include <gtsam/slam/dataset.h>
20 
23 
24 using namespace std;
25 using namespace gtsam;
26 using namespace gtsam::serializationTestHelpers;
27 
28 /* ************************************************************************* */
29 TEST(dataSet, sfmDataSerialization) {
30  // Test the serialization of SfmData
31  const string filename = findExampleDataFile("dubrovnik-3-7-pre");
32  SfmData mydata;
33  CHECK(readBAL(filename, mydata));
34 
35  // round-trip equality check on serialization and subsequent deserialization
36  EXPECT(equalsObj(mydata));
37  EXPECT(equalsXML(mydata));
38  EXPECT(equalsBinary(mydata));
39 }
40 
41 /* ************************************************************************* */
42 TEST(dataSet, sfmTrackSerialization) {
43  // Test the serialization of SfmTrack
44  const string filename = findExampleDataFile("dubrovnik-3-7-pre");
45  SfmData mydata;
46  CHECK(readBAL(filename, mydata));
47 
48  SfmTrack track = mydata.track(0);
49 
50  // round-trip equality check on serialization and subsequent deserialization
51  EXPECT(equalsObj(track));
52  EXPECT(equalsXML(track));
53  EXPECT(equalsBinary(track));
54 }
55 
56 /* ************************************************************************* */
57 int main() { TestResult tr; return TestRegistry::runAllTests(tr); }
58 /* ************************************************************************* */
#define CHECK(condition)
Definition: Test.h:109
Define the structure for SfM data.
Definition: dataset.h:326
static int runAllTests(TestResult &result)
Definition: Half.h:150
string findExampleDataFile(const string &name)
Definition: dataset.cpp:65
Define the structure for the 3D points.
Definition: dataset.h:220
#define EXPECT(condition)
Definition: Test.h:151
SfmTrack track(size_t idx) const
The track formed by series of landmark measurements.
Definition: dataset.h:341
TEST(dataSet, sfmDataSerialization)
traits
Definition: chartTesting.h:28
utility functions for loading datasets
bool readBAL(const string &filename, SfmData &data)
This function parses a "Bundle Adjustment in the Large" (BAL) file and stores the data into a SfmData...
Definition: dataset.cpp:1073


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:49:23