42 using namespace gtsam;
44 int main(
int argc,
char* argv[]) {
53 auto poseNoise = noiseModel::Diagonal::Sigmas(
54 (
Vector(6) << Vector3::Constant(0.1), Vector3::Constant(0.3))
60 Cal3_S2 K(50.0, 50.0, 0.0, 50.0, 50.0);
61 auto measurementNoise =
62 noiseModel::Isotropic::Sigma(2, 1.0);
63 for (
size_t i = 0;
i < poses.size(); ++
i) {
64 for (
size_t j = 0;
j < points.size(); ++
j) {
78 noiseModel::Isotropic::Sigma(3, 0.1);
83 auto calNoise = noiseModel::Diagonal::Sigmas(
84 (
Vector(5) << 500, 500, 0.1, 100, 100).finished());
91 for (
size_t i = 0;
i < poses.size(); ++
i)
94 Point3(0.05, -0.10, 0.20))));
95 for (
size_t j = 0;
j < points.size(); ++
j)
97 points[
j] +
Point3(-0.25, 0.20, 0.15));
101 result.
print(
"Final results:\n");
virtual const Values & optimize()
IsDerived< DERIVEDFACTOR > emplace_shared(Args &&... args)
Emplace a shared pointer to factor of given type.
A non-templated config holding any types of Manifold-group elements.
Factor Graph consisting of non-linear factors.
static Cal3_S2 K(500, 500, 0.1, 640/2, 480/2)
NonlinearFactorGraph graph
T compose(const T &t1, const T &t2)
void addPrior(Key key, const T &prior, const SharedNoiseModel &model=nullptr)
std::vector< gtsam::Point3 > createPoints()
static Point2 measurement(323.0, 240.0)
void print(const std::string &str="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const
Point2 project(const Point3 &pw, OptionalJacobian< 2, 6 > Dpose={}, OptionalJacobian< 2, 3 > Dpoint={}, OptionalJacobian< 2, DimK > Dcal={}) const
project a 3D point from world coordinates into the image
The most common 5DOF 3D->2D calibration.
int main(int argc, char *argv[])
Simple example for the structure-from-motion problems.
void insert(Key j, const Value &val)
static const CalibratedCamera camera(kDefaultPose)
a general SFM factor with an unknown calibration
Eigen::Matrix< double, Eigen::Dynamic, 1 > Vector
std::vector< gtsam::Pose3 > createPoses(const gtsam::Pose3 &init=gtsam::Pose3(gtsam::Rot3::Ypr(M_PI/2, 0,-M_PI/2), gtsam::Point3(30, 0, 0)), const gtsam::Pose3 &delta=gtsam::Pose3(gtsam::Rot3::Ypr(0,-M_PI/4, 0), gtsam::Point3(sin(M_PI/4) *30, 0, 30 *(1-sin(M_PI/4)))), int steps=8)