timeSFMBAL.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 "timeSFMBAL.h"
20 
24 #include <gtsam/geometry/Point3.h>
25 
26 
27 using namespace std;
28 using namespace gtsam;
29 
32 
33 int main(int argc, char* argv[]) {
34  // parse options and read BAL file
35  SfmData db = preamble(argc, argv);
36 
37  // Build graph using conventional GeneralSFMFactor
39  for (size_t j = 0; j < db.numberTracks(); j++) {
40  for (const SfmMeasurement& m: db.tracks[j].measurements) {
41  size_t i = m.first;
42  Point2 z = m.second;
44  }
45  }
46 
48  size_t i = 0, j = 0;
49  for (const SfmCamera& camera: db.cameras)
50  initial.insert(C(i++), camera);
51  for (const SfmTrack& track: db.tracks)
52  initial.insert(P(j++), track.p);
53 
54  return optimize(db, graph, initial);
55 }
optimize
int optimize(const SfmData &db, const NonlinearFactorGraph &graph, const Values &initial, bool separateCalibration=false)
Definition: timeSFMBAL.h:64
initial
Values initial
Definition: OdometryOptimize.cpp:2
SfmFactor
GeneralSFMFactor< Camera, Point3 > SfmFactor
Definition: timeSFMBAL.cpp:31
GeneralSFMFactor.h
a general SFM factor with an unknown calibration
Point3.h
3D Point
main
int main(int argc, char *argv[])
Definition: timeSFMBAL.cpp:33
gtsam::SfmData
SfmData stores a bunch of SfmTracks.
Definition: SfmData.h:39
gtsam::SfmTrack
Definition: SfmTrack.h:125
gNoiseModel
static SharedNoiseModel gNoiseModel
Definition: timeSFMBAL.h:41
gtsam::SfmData::tracks
std::vector< SfmTrack > tracks
Sparse set of points.
Definition: SfmData.h:42
j
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2
gtsam::PinholeCamera< Cal3Bundler >
gtsam::NonlinearFactorGraph
Definition: NonlinearFactorGraph.h:55
timeSFMBAL.h
Common code for timeSFMBAL scripts.
PinholeCamera.h
Base class for all pinhole cameras.
pybind_wrapper_test_script.z
z
Definition: pybind_wrapper_test_script.py:61
m
Matrix3f m
Definition: AngleAxis_mimic_euler.cpp:1
gtsam::Point2
Vector2 Point2
Definition: Point2.h:32
preamble
SfmData preamble(int argc, char *argv[])
Definition: timeSFMBAL.h:44
C
Matrix< Scalar, Dynamic, Dynamic > C
Definition: bench_gemm.cpp:50
gtsam
traits
Definition: SFMdata.h:40
gtsam::SfmData::cameras
std::vector< SfmCamera > cameras
Set of cameras.
Definition: SfmData.h:40
gtsam::Values
Definition: Values.h:65
std
Definition: BFloat16.h:88
gtsam::GeneralSFMFactor
Definition: GeneralSFMFactor.h:59
P
static double P[]
Definition: ellpe.c:68
initial
Definition: testScenarioRunner.cpp:148
camera
static const CalibratedCamera camera(kDefaultPose)
gtsam::SfmTrack::p
Point3 p
3D position of the point
Definition: SfmTrack.h:126
graph
NonlinearFactorGraph graph
Definition: doc/Code/OdometryExample.cpp:2
gtsam::SfmData::numberTracks
size_t numberTracks() const
The number of reconstructed 3D points.
Definition: SfmData.h:74
Camera
PinholeCamera< Cal3Bundler > Camera
Definition: timeSFMBAL.cpp:30
Cal3Bundler.h
Calibration used by Bundler.
i
int i
Definition: BiCGSTAB_step_by_step.cpp:9
gtsam::FactorGraph::emplace_shared
IsDerived< DERIVEDFACTOR > emplace_shared(Args &&... args)
Emplace a shared pointer to factor of given type.
Definition: FactorGraph.h:153
gtsam::SfmMeasurement
std::pair< size_t, Point2 > SfmMeasurement
A measurement with its camera index.
Definition: SfmTrack.h:32


gtsam
Author(s):
autogenerated on Fri Nov 1 2024 03:42:13