27 using namespace gtsam;
37 int main (
int argc,
char* argv[]) {
41 if (argc>1) filename = string(argv[1]);
53 noiseModel::Isotropic::Sigma(2, 1.0);
68 graph.
addPrior(
C(0), mydata.
cameras[0], noiseModel::Isotropic::Sigma(9, 0.1));
69 graph.
addPrior(
P(0), mydata.
tracks[0].p, noiseModel::Isotropic::Sigma(3, 0.1));
84 }
catch (exception&
e) {
87 cout <<
"final error: " << graph.
error(result) << endl;
virtual const Values & optimize()
Define the structure for SfM data.
Factor Graph consisting of non-linear factors.
void insert(Key j, const Value &val)
NonlinearFactorGraph graph
GeneralSFMFactor< SfmCamera, Point3 > MyFactor
std::vector< SfmTrack > tracks
Sparse set of points.
void addPrior(Key key, const T &prior, const SharedNoiseModel &model=nullptr)
string findExampleDataFile(const string &name)
std::pair< size_t, Point2 > SfmMeasurement
A measurement with its camera index.
size_t number_tracks() const
The number of reconstructed 3D points.
IsDerived< DERIVEDFACTOR > emplace_shared(Args &&...args)
Emplace a shared pointer to factor of given type.
Define the structure for the 3D points.
void setVerbosity(const std::string &src)
A nonlinear optimizer that uses the Levenberg-Marquardt trust-region scheme.
Array< double, 1, 3 > e(1./3., 0.5, 2.)
static SmartStereoProjectionParams params
int main(int argc, char *argv[])
Matrix< Scalar, Dynamic, Dynamic > C
std::vector< SfmCamera > cameras
Set of cameras.
Point3 p
3D position of the point
double error(const Values &values) const
static const CalibratedCamera camera(kDefaultPose)
a general SFM factor with an unknown calibration
utility functions for loading datasets
std::vector< SfmMeasurement > measurements
The 2D image projections (id,(u,v))
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...
size_t number_cameras() const