testSfmTrack.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 
20 #include <gtsam/inference/Symbol.h>
22 #include <gtsam/sfm/SfmTrack.h>
23 
24 using namespace std;
25 using namespace gtsam;
26 
27 /* ************************************************************************* */
28 TEST(SfmTrack2d, defaultConstructor) {
29  SfmTrack2d track;
30  EXPECT_LONGS_EQUAL(0, track.measurements.size());
31  EXPECT_LONGS_EQUAL(0, track.siftIndices.size());
32 }
33 
34 /* ************************************************************************* */
35 TEST(SfmTrack2d, measurementConstructor) {
36  SfmTrack2d track({{0, Point2(1, 2)}, {1, Point2(3, 4)}});
37  EXPECT_LONGS_EQUAL(2, track.measurements.size());
38  EXPECT_LONGS_EQUAL(0, track.siftIndices.size());
39 }
40 
41 /* ************************************************************************* */
42 TEST(SfmTrack, construction) {
43  SfmTrack track(Point3(1, 2, 3), 4, 5, 6);
44  EXPECT(assert_equal(Point3(1, 2, 3), track.point3()));
45  EXPECT(assert_equal(Point3(4, 5, 6), track.rgb()));
46 }
47 
48 /* ************************************************************************* */
49 int main() {
50  TestResult tr;
51  return TestRegistry::runAllTests(tr);
52 }
53 /* ************************************************************************* */
Point3 rgb() const
Get RGB values describing 3d point.
Definition: SfmTrack.h:147
static int runAllTests(TestResult &result)
Factor Graph consisting of non-linear factors.
A simple data structure for a track in Structure from Motion.
Vector2 Point2
Definition: Point2.h:32
std::vector< SiftIndex > siftIndices
The feature descriptors (optional)
Definition: SfmTrack.h:47
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
Definition: Matrix.cpp:40
int main()
Definition: BFloat16.h:88
const Point3 & point3() const
Get 3D point.
Definition: SfmTrack.h:144
Track containing 2D measurements associated with a single 3D point. Note: Equivalent to gtsam...
Definition: SfmTrack.h:42
#define EXPECT(condition)
Definition: Test.h:150
std::vector< SfmMeasurement > measurements
The 2D image projections (id,(u,v))
Definition: SfmTrack.h:44
traits
Definition: chartTesting.h:28
#define EXPECT_LONGS_EQUAL(expected, actual)
Definition: Test.h:154
TEST(SfmTrack2d, defaultConstructor)
Vector3 Point3
Definition: Point3.h:38


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:39:31